In an View Controller, I have a button that creates a popOverCOntroller which contains a TableView. When the user selects something from that tableView, I want a TextField in the ViewController to populate with the text from the tableView and the popOverCOntroller to dismiss showing the ViewController.
The popOverCOntroller, ViewController,TableView code all work. I can’t figure out how to get the text back to the original ViewController.
Thanks, and I know this is abstract. Can Someone talk me through the steps I’m missing?
Eric
You can consider passing the reference to the text field or a mutable string via the TableViewController’s custom init method.
If you choose to pass the text field, you can directly assign the value when the user selects a row and dismiss the popover view. If you pass a mutable string, you can set its value and later in the popover’s delegate method, set the value of the text field.
Let me know if you need some code to go with it.
Edit
You will need to store a weak reference to the UIPopOverController if you need to programmatically dismiss it.
labelToUpdateis the label we are going to update.In the UIPopOverController delegate, which would be the parent view controller, do this –