Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rupesh.swami

macrumors newbie
Original poster
Mar 9, 2009
29
0
hi all,
i am new to iPhone programming,
in Safari browser(iPhone), when we navigate a page which contain multiple user entry field (related to UITextField), then it display a toolbar which contains Previous,Next and done button and click on these buttons facilitate us to navigate between these user entry fields.
How can i make this object or whether IB contains this type of object?
 

johnnyjibbs

macrumors 68030
Sep 18, 2003
2,964
122
London, UK
I would create a toolbar (UIToolbar) and then set the next and back buttons (or whatever you want) as items on the toolbar.

Something like:

Code:
[toolbar setItems:[NSArray arrayWithObjects:backButton,flexSpace,nextButton,nil] animated:NO]

where backButton and nextButton are UIBarButton objects. The flexSpace is also a UIBarButton but a special type that would mean your buttons are on the left and the right of the toolbar. In the above example, 'toolbar' is an instance of UIToolbar that has already been created.

You may be able to create toolbars using Interface Builder but you will need to programmatically move them in time with the keyboard using Core Animation. The animation code would need to be executed when the text field in question becomes the first responder.

To be honest, I think you need to try out some example code on more simple techniques before getting too much into this kind of thing at this stage.
 

rupesh.swami

macrumors newbie
Original poster
Mar 9, 2009
29
0
I would create a toolbar (UIToolbar) and then set the next and back buttons (or whatever you want) as items on the toolbar.

Something like:

Code:
[toolbar setItems:[NSArray arrayWithObjects:backButton,flexSpace,nextButton,nil] animated:NO]

where backButton and nextButton are UIBarButton objects. The flexSpace is also a UIBarButton but a special type that would mean your buttons are on the left and the right of the toolbar. In the above example, 'toolbar' is an instance of UIToolbar that has already been created.

You may be able to create toolbars using Interface Builder but you will need to programmatically move them in time with the keyboard using Core Animation. The animation code would need to be executed when the text field in question becomes the first responder.

To be honest, I think you need to try out some example code on more simple techniques before getting too much into this kind of thing at this stage.


but i think this approach require create toolbar for each view in my application and reposition the view manually on click of Previous and Next button
 

johnnyjibbs

macrumors 68030
Sep 18, 2003
2,964
122
London, UK
The problem is that you can't access the keyboard API (as far as I know), although it does give out height notifications which you can do to ensure you toolbar is always in the right place in relation to the keyboard.

If you were allowed to access and subclass the keyboard API you could make a custom version, complete with Previous and Next buttons, but as far as I know this is not possible - at the moment at least.

You could create a template view controller that handles all the text fields so that you would only have to program it once.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.