I have a ViewController with a number of fields. One of these fields is a text box, I want the user to be able to tap on the text field and be presented with a table view where they can select from a pre-defined list and their selection will then be filled in the text box. Can anyone point me in the direction of a tutoria开发者_开发问答l or some sample code would be great.
Thanks Stephen
Is this view controller in a Navigation Controller? if so you can simply push a new UITableViewController onto the navigation controller and do it that way. If you are not using a navigation controller, implementing a pickerview would work better than trying to present a tableview modally if it is just a selection from a predefined set of items.
That being said, if you do want the table view, and don't want to add a navigation controller, the way to do it is to presentModalViewController:viewController and then when the user selects a row, save his selection and dismiss the modal controller and update your textfield.
精彩评论