Do I have to use buttons? - objective-c

I am making an app. It is kind of a hide and go seek. I was thinking about sectioning off separate areas and having the app say something different as to where you touched the screen. It will give you clues to where on the screen you need to touch next. So, these are my questions:
What is the easiest way? Would I want to make a grid of roundrectbuttons-placing each one and making an outlet for each - or can I make grid of buttons some other on the screen.If I place each button I will have a 9x12 of buttons making 108 buttons. Then I need to have a way to choose a random button as to where the location of the thing is question is. Would I use buttons at all or is there an easier way?

108 buttons is far too many to place in a xib :) If you wanted to use buttons then I would create them programatically in viewDidLoad in your controller.
Hoewever, I wouldn't use buttons at all!
I would use a TapGestureRecognizer attached to your background view. When you recieve a tap, take a look at where it was (use locationInView:self.view) and use that to work out what to do with the press.

Related

iOS: People picker inside UIPopoverController, search keyboard distorts popover

I have a people picker inside a UIPopoverController, since it has a search field, which will trigger the keyboard when tapped, then I got this ugly result:
the arrow of the popover is UP which is best look in my app, I also tried to use UP | DOWN but it does not work(still always UP), I know I can use only DOWN arrow instead, but that should be the last solution, I wonder is there any method to deal with this?
Thanks!
update:
I was thinking that can I use UP arrow first, then when the search field becomes first responds(not sure how to detect this), I change it to DOWN arrow(also not sure how to do this)?
update 2:
also the view is not a table or something that can be scrolled, so I cannot scroll the view to make the popover look fine.
You are right, that is quite an ugly resolution.
The problem is that the UIPopoverController is coded to avoid colling with the keyboard view.
I think the only way you can work around this is to either create a custom UIPopoverController that ignores the keyboard appearing (i believe some listeners needs to be disabled on either the SharedApplication or mainscreen) or make a custom UIView that holds this.

XCode: Best Way To Handle A New View In A Tabbed Application

In an iOS Tabbed Application I'm making, I've got tabs to load different viewControllers, which is pretty standard. What I'd like to do is make a few buttons (with images on them) load up another view with the button image maximized to the screen. However, I'm not really sure how to go about doing this. I don't want a new tab for this, I just want another view to show the full image, and then a button to return to the tabbed view. I've experimented a bit with making a subview to do this, and I've attempted to change the main viewport to the new view, with no success. If someone could point me in the right direction, and maybe give me a solid concept as a jumping-off point, I would really appreciate it.
And to clarify, I'm not looking for "the best way", per se. I'd be willing to accept a quick and dirty fix. But if you know of more than one way to handle this situation, I would appreciate whichever one you personally think is better.
I would do it by creating a UINavigationController to use as the primary tab view. When you want to show the full screen button, you create a new UIViewController subclass (below) and push it. That class will return YES for the method "hidesBottomBar" (its something like that).
This new view controller will be a traditional controller. You can create a UIImageView to fill the view (or you can probably replace the view with the imageView). In the viewDidLoad you'll set the UIImage of the view (or you can enter its name in the nib).
When someone clicks on the button, then you'll pop that view and return to your tabbed view (where the tab bar is showing).
I did something like this (not a big button), so I know the tab bar can be made to hide on the push. You can also hide the navigation bar so it never is even show (again, not 100% sure at the moment how to do it but its possible).

iOS layout: alternative to tabs?

I'm working on a iPhone app which shows an mobile webform in a UIWebView. I'm using a default iOS layout with a navigation and tab bar.
The mobile webform is displayed in a UIWebView in the white area. Since the webform has a lot of input fields, we really need as must space for it as possible. Because of this, we are planing to remove the tabs in the bottom. Over time, there will be more tabs/sections, so it is not a solution to just add a button for each section in the left side of the navigation bar. On a iPad a popover could easily be used to handle this.
Is there a standard iOS layout mechanism to handle this change of sections/views without using tabs?
You could do something long the lines of Path or the new Facebook app and have the "table of contents" behind the Navbar and the navbar slides away (along with the child view) to reveal it. When done right (ie smoothly) I think the effect is really cool.
This would also work great as you add more and more options, since the table could just scroll.
Here is a framework that might be you started: http://www.cocoacontrols.com/platforms/ios/controls/iiviewdeckcontroller
I would consider replacing the navigation bar's title with a control that lets you switch between tabs. You can assign the bar's titleView property to a control or a button and it will generally do the right thing.
If you're limited to 2-3 tabs, you could simply use a UISegmentedControl.
If you want more, you could use a button which, when tapped, pops up a view that allows you to select the view you want. This could be a modal table view, or you could slide up a UIPickerView from the bottom of the screen, similar to the keyboard.
I use this technique in an app of my own, screenshots here. Tapping the button cycles between views (in this case, I'm changing the contents of the table cells); tap-and-hold slides up a picker.
Another possibility would be to arrange your different forms on pages in a scroll view with a page control at the bottom, à la Weather. The best option, though, if you’re going to have a particularly long list and want to keep your screen real estate, is probably the FB/Path-style sidebar table.
I ended up using a UIActionSheet but I think it in other situations would be more stylish to use a controller like the IIViewDeckController.

Customizing UIToolBar the foursquare way

I'd like to customize my UIToolBar, so the centered button looks something similar to the check-in foursquare button.
I've seen a commercial source code called ALToolBar, wich is similar to the effect I want on my UIToolBar. So in resume, changing the height of a button, and the background of a specific button, if that is the right way to go.
I'm pretty new to iOS, but comfortable enough to dig ideas the community can bring on.
Thanks for your help.
One approach is to just write your own Tabbar/Toolbar instead of using the built-in classes. Subclass UIView and add UIButtons for each item, which you can then customize as you wish.
The downside to this approach is, you loose the "More" functionality, that allows you to drag-and-drop items into the Tabbar, but if you just have 5 or fewer items, that's fine.

adding an invisible button to the background in IB

I'm working with Xcode doing a Ipad app.
i simply want user to click anywhere on screen (not counting text fields) to perform some IBAction.I'm using an invisible button that covers my whole view.
Since I have some text fields in my view,i need to add this invisible button to the background of my user interface. I cant seem to find this option in the button attributes? any help?
Just set the button's type to custom.
Did you try setting the opacity of the button to zero?
I guess i got your point. You just want to put the UIButton(invisible) on the back of all the UITextField. The simple solution to this is open the Document Window in the IB. Now expand the view tree in the list view. Just drag your UIButton above the UITextFields and set the alpha value for the button in the property to be zero.
Hope this helps!!
iPad users don't "click". They "tap" or "touch".
In Interface Builder, I believe views are constructed with a z-index from top to bottom as they appear in the document window, so dragging your button so that it appears as the first subview of your main view should be a quick fix for this.
Have you considered other approaches? This doesn't sound like standard behaviour for an app and will probably cause havoc with anybody using Voice Over. What are you trying to accomplish?