Alternatives for picker in iphone/iOS app? - iphone

I am showing a form the user fills in my iPhone app. One of the fields is a set of 2 or 3 dates from which the user has to pick one. Putting a picker, or bringing up a table view just for this takes up too much space, leaving no room for the other fields. Is there any simpler way to do this?

To do this you can put two or three arrowed label with text like "Select Date" upon click of it you can show one view that allow user to select the date; once selected you can back to the original view. You can do this for all three (or two) dates and get those date on form view.
I am giving you idea of how you can design apps; if you want code i can assist that too but from your question it seems you want design ideas.

You can go for your custom drop down/combo box, but their is no inbuilt functionality present for this.
Also following is mentioned in apple HIG guideline, you need to consider those as well-
(http://developer.apple.com/library/IOs/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html)
Guidelines
Use a picker to make it easy for people to choose from a set of values. It’s often best to use a picker when people are familiar with the entire set of values. This is because many, if not most, of the values are hidden when the wheel is stationary. If you need to provide a large set of choices that aren’t well known to your users, a picker might not be the appropriate control.
Consider using a table view, instead of a picker, if you need to display a very large number of values. This is because the greater height of a table view makes scrolling faster.
Use the translucent selection bar to display contextual information, such as a unit of measurement. Do not display such labels above the picker or on the wheel itself.
On iPad, present a picker only within a popover. A picker is not suitable for the main screen.

Related

Should I make separate UIViewController just because a single row is different in layout

I am a very basic SWIFT Xcode programmer. I make small apps.
For last 2 days, I am stuck at a very simple thing and I am sure with your guidance I can quickly make a decision.
I have a UIViewController class as well as an xib
In the layout I have 4 textfields
Now based on a user setting (in another frame user make a choice), I will either have to show 4 textfields ** OR ** 3 textfields and a UISwitch.
Long story short, if user select one option he should see UISwitch and 3 textfields or else 4 textfield. The labels's text also change.
To my limited knowledge, I will make another UIViewController, another XIB file and if user selection allows I will segue to the new UIViewController.
But all this looks so redundant. How do you smart people do this thing?
(Edit)
I use size classes in my layout as well as constraints in the visual editor for positioning of elements on the layout. If I change things programmatically, which is one option, how will I manage the layout ?
Please advise.
Show me the right path please.
When user select first option based on action show or hide the text field or switches, like when user select first option only show three text field and one UIswitch hide fourth text field.
And programatically change text field hint value and also set NSString Tag="first" so that when you want that value at the time of submit button you can apply if condition to tag and on that basis you can get your desired output on each selection.

iOS: Search Options UI

I am building an iPhone app for a library and I want to give few options to the user to search books by. A user can search a book by title, author, topics, or date of publication.
What I want to know what's the best way to display these search options to the user? In terms of HTML, it would be easy - either use a drop down list or radio buttons. I tried using UIPickerView but honestly, that looks terribly ugly and destroys the aesthetics of the view of my app.
The other option I was thnking was using segmented control, but is it possible to have a vertical segment control in stead of horizontal one? The selection texts can be too long.
Any ideas?
If you want a vertical segmented control, you'll have to make it yourself. Create a textured image with dividers. I would export each section as a PNG separately. Then create a picture of each section with the "pressed down" gradient and export each segment as a separate PNG again.
I would then make a new class. If there is a specific number of objects in your segmented control or this is a one time thing, the class may not even be necessary. If not, then in the class constructor pass an array with the titles of the segments in your segmented control. For the first and last objects, use the pictures you made with rounded corners. For the objects in between, use the standard pictures. Then put the titles on top. When a segment is tapped (perhaps use hidden UIButtons), you can use a delegate method to tell the main search class which one was tapped, and then the class can replace the normal picture of that segment with the pressed down one.
Thanks for the options.
I ended up creating a simple table to show my choices.
User clicks on "search by", which opens up the table with options and then when you select any option, you return back to main view with the chosen search option.

Best approach to create a "settings" dialog page in iPhone [duplicate]

This question already has answers here:
How to create a UITableView with editable components?
(2 answers)
Closed 3 years ago.
I need to present the user with a screen with controls (i.e. a dialog). It will display some labels and different types of controls so that the user can do some configuration:
select a color (custom color picker)
select a line width (slider)
select one value from a list of values (UISegmentedControl?)
enable / disable one option (On/Off)
...
I am evaluating different alternatives:
Create the layout with labels and controls in InterfaceBuilder
Use a UITableView, so that each cell contains a label and its control
I like option 2 because it is similar to iPhone Settings app, and it makes the screen look organized, giving you sections, scroll..., but it is a real pain to create in code all different cell layouts, taking into account each row heights...
The solution has to be easiliy maintainable, allowing easy reuse of code, DRY (low repetition), data-driven...
Is there a recommended or standard aproach to do this?
Instead of implementing it yourself you might also like to consider some of the open source solutions. I use InAppSettingsKit in my app. There are a few minor UI glitches but it works well. I also evaluated mySettings (indeed I submitted a couple of patches) and InAppSettings.
Even if you don't use them, you might be able to crib a few ideas from them.
You can create the tableview cells in IB and then just create IBOutlets to each cell, and then return each cell in the data source method (forgotten the exact name of it, its where you normally create cells)
You could create a cell in IB for each cell or create different types of cells in IB, say one slider based cell, etc and programmatically change the text, etc.
This is staticly creating a tableview, theres an Apple guide on it somewhere.
you said it. use a UITableView and create custom UITableViewCells (probably in Interface Builder!) and add these in.
Also, as far as selecting a value from a list of values.. a drill in UITableView (embed the root UITableView in a navigation controller) with all the options and then a checkmark is probably advisable (this is how most apps handle this behavior). The On/Off button is more suited for UISegmentedControl.
There are great examples of this in this book.
Good luck.

distribute option in interface builder of iPhone

i have following buttons in my application.
Now i want to set equal spacing among all buttons.
Suppose If I am using corelDraw or Photoshop, there is always an option for align & distribute.
Here I need to distribute my objects vertically.
How is that possible in interface builder of iPhone?
Sample image is given below, in which distribution is required.
alt text http://img268.imageshack.us/img268/4146/problem13.png
I know this post is ages ago, but for the sake of simplicity (maybe) and to avoid using table views (for sure)...
In your example, if you select the first UIButton, keyword, and press option key, interface builder shows you the relative distance from the center to any other object you hover with the mouse. So if you decide the optimal distance is the one between keyword and category buttons, you can apply that distance for the rest of objects simply adding or substracting the appropriate amount of pixels from the button size inspector.
Hope it helps!
Depending on the type of object, you might do this.
Select all implied objects.
Select Editor->Embed in->Matrix;
this will place the objects regularly.
Then select the option Editor->Unembed
and the objects will keep their new positions. Hope this helps!
I dont think there an option to do it automatically, you can do some math though and get them to have equal spacing by setting their frames...
Another option is to place all of these in a table (since they look like table view cells anyway), and adjust an empty footer view height to get the spacing you want between elements.
Of course that means you don't get to view the layout in IB.
It's even simpler - Simply drag a "Flexible Space Bar Button Item" from the Object Library in Xcode into each gap. It will automatically expand to equispace your other items.
&

How do I create a dictionary-style scroll bar for iPhone (like in the Contacts list)?

I am creating an iPhone app which I would like to have a similar interface to the iPhone's native contact picker view, i.e. an alphabetical list which you can scroll through, with a search bar up top which narrows down the list. Particularly, I'd like to be able to show the letters of the alphabet down the side so that as you scroll through the list, you see your position in the alphabet in the scrollbar. The problem is that my data basically consists of key-value pairs, not contact data, so I can't easily use the native contact picker.
As far as I can see, I have two options to achieve what I want:
Use the ABPeoplePickerNavigationController class and hack it to use an address book which I fill myself with non-address type data. The problem with this is that, by default, the address book will fill up with the contacts from the iPhone so that each time the app opened, I'd have to flush those contacts and build my own list. (Not to mention other problems associated with using an interface which is bound to a particular data structure)
Use a UISearchBar and UIScrollView. This would be fine, but I'm not sure how to do anything to the scroll bar except change its colour - I can't see how to override its contents.
Any advice on which is the simplest way? What are the pitfalls (particularly of 1)?
To get the letters down the side, you can just provide a -sectionIndexTitlesForTableView: method in your table view datasource. As for searching, there's a bit more work there, and it's very dependent on your data. A UISearchBar is the place to start, however.
For a search bar, have a look at TTSearchBar in the Three20 library.
Everything else can be easily implemented using UITableView.