In my iOS app i have one view controller that handles my main view. If i have a button on that view can i have it open up a modal table view so the user can select a row from the table and then a label on the main view is equal to the selected row text?
Share
Sure, it’s possible. You could use the method, presentViewController:animated:completion:, to present a modal table view controller. The main view controller has a property, presentedViewController which gives you access to that controller (the one you’re presenting) so you can get the value of one of its properties (which would be set to the text of the selected row).
After Edit:
You can do it this way. In the presenting view controller have this:
In the init method (or viewDidLoad) register to receive a notification with this line:
Then these 2 methods:
And here is an example of what can be done in the table view controller subclass: