views:

492

answers:

2

Hi All,

I want to add buttons like previous, next, done, Go when I am filling out some text fields in my iPhone application. Could you let me know how can I do that?

Thanks.

+1  A: 

iPhone app is usually composed from multiple UIViewControllers.

Each UIViewController manages data and the view that displays the data.

UIViewControllers can be grouped by UINavigationController or UITabController both of which add navigation elements to navigate between different UIViewControllers.

For example tab controller draws tabs at the bottom of the screen so you can switch between views. Navigation controller adds 'back' button, so you can go back to previous screen, and you can add extra functionality like edit/add/delete buttons that operate on your view.

Have a look at UINavigationController, UIViewController and maybe UITableView.

It would help if you explained a bit about how is your form designed to understand what prev/next button are for e.g. is this for navigating between multiple screens of the same form? I suspect that UINavigationController is what you need.

stefanB
+1  A: 

If this is what you're asking about, the "Previous", "Next", and "Done" buttons seen above the toolbar in Safari are basically just a UIToolbar positioned right above the keyboard. There is no built-in mechanism for performing the actions for these buttons, so you'll have to write them yourself.

"Done" should make the field resign its first responder status; "Previous" and "Next" should change which field is the first responder. You can observe UIKeyboardWillShowNotification and UIKeyboardWillHideNotification to determine when to show and hide this toolbar and where to place it on the screen.

Brent Royal-Gordon