How can I put scroll in my iphone view? - iphone

in my viewDidLoad, there is too much data,
so what should I do so that I can use all of them,
some sort of scroll, but how to code it ?
Picture (you cannot go to the next step if you do not input a picture. Existing or snap a new one)
Name
Age
Gender
Profession
Hobby
Things I like
Things I dislike
Business Address/Home Address (you choose one first and then you can type in the field)
Email Address
Other (this field does not have to match to others for a connection to be made)
Phone number (Automatically it will show the persons phone number)
There are fields, and I can make them, but there is not more space for me :-(

Use a UIScrollView. But you already know that I guess. Read this up Learning the basics of UIScrollView
Alternatively, you may also explore UITableView if your data represents a logical group or set which can be presented as cells/rows on a TableView.

Related

Alternatives for picker in iphone/iOS app?

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.

.xib with multiple UITableView or multiple lists in UIPopoverController

So I need to create a filter that is presented from a UIPopoverController. The different lists to filter on go to the data manager (model) class and query the sqlite database. The problem I am having conceptualizing is how to do this for multiple UIPopoverControllers with the most reusability. What I mean by that is, if I have two filters, one for say fruits, and another for say vegetables. Each one needs to be presented in a popover.
What I have done is, I have a UITableView that has a generic array. In the class that presents the popover, depending on what filter was pressed, I present the popover with the UITableView and the corresponding fruit and vegetable list.
The tricky part for me is, the problems with the checkmarks. Since my list consists of "All", plus each entry like "Apple" or "Orange", when the user selects All, no other checkmarks are visible. If the user selects apple, then all is deselected, and apple is selected with a checkmark. If apple is selected again, then apple is deselcted, and All is reselected. The way I handle this is, in didSelectrowForIndexPath, I query the model class, get my NSDictionary of YES/NO values for each key, and set it. This also takes care of when the popover is closed, and then presented again, then the checkmarks are all there in the last state they were in since the model was already updated.
So my two questions are
(1) if this implementation is 'ok,' then how would I have a separate list for each UITableView? It seems like since the UITableView manages one list, I would need to create multiple UITableViews, one for each filter, so those specific calls to the data manager, like "All", don't mess up the other filters
(2) is there a better way to do this? I'm open to suggestions! Thanks!
You may want to reconsider the user interface. It may not be necessary to have "All" as an option, and it may even be preferable to leave it out.
I've checked out how such filters work in other apps, and I've found that "All" is often not an option. When the table first appears, all fruits, say, are shown by default. When one entry, say "Apple", is selected, only apples are shown. When "Apple" is deselected, all results are shown once again.
This, of course, is the inverse of what is logical. Logically, if nothing is selected, nothing should be shown. However, I've found that when you're using such a filter without the "All" option, you don't realize the logical inconsistency and it somehow works very smoothly, as you would expect it to. On the other hand, it may appear more cumbersome for the user experience to have "All" being checked and unchecked automatically when the user is selecting an entirely different entry.
I've implemented a filter in just this way. In my opinion, it's more user friendly even if it's less logical.
As to the implementation, I just subclassed UITableViewController and set an array property for the filter entries. Then I re-use my subclass for different filters.

UITableView not working. Why?

I have a UITableViewController and I have specified the index titles so that the user can skip to specific letters much like the iPod app (the song list, specifically) on an iPhone. I have set up everything and implemented all the methods in the UITableViewProtocol.
Now, here is the problem. When I click an index on the right side (they are letters), the Table does not update properly. The top of it does update with the title I click on, but the actual rows do not. Why would this be happening? What method would I need to check? I find it weird that the title changes by the row content stays the same.
Thanks!
Are you setting up your dataSource as a two dimensional array? The indexes on the right will sort by the outside index.
Check out Apple's explanation on how to populate an indexed table. If you follow their code sample you should be able to get it to work.
http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/TableView_iPhone/CreateConfigureTableView/CreateConfigureTableView.html

Laying out UIButtons - easy way?

I am making a table which has a row that looks like the "To:" line in the Apple Mail app. When you add new people to Mail from your address book, their name shows up in a rounded button.
I can create the button and use sizeToFit to make it fit snugly around the text - no problem.
However, once I do that, I can't figure out how wide the button has become. Is there an easy way to just stick a bunch of buttons in a cell and have it wrap as necessary automatically, or do I have to manually calculate the width and if it goes beyond the end of the screen, move to the next row?
Also, how do you get the width of a sizeToFit'ted button? button.frame returns null. Most perplexing.
You might want to take a look at Joe Hewitt's three20 project, a collection of custom UI elements for the iPhone that were used in the development of the Facebook app.
The two classes you would be particularly interested are TTMessageController and TTPickerTextField.
From the project site:
TTMessageController emulates the
message composer in Apple's Mail app.
You can customize it to send any kind
of message you want. Include your own
set of message fields, or use the
standard "To:" and "Subject:".
Recipient names can be autocompleted
from a data source that you provide.
TTPickerTextField is a type-ahead
UITextField. As you type it searches a
data source, and it adds bubbles into
the flow of text when you choose a
type-ahead option. I use this in
TTMessageController for selecting the
names of message recipients.

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.