In the app I'm creating, one of the features is that users can submit their own quotes to be displayed in the app. There is one storyboard segue that lets the user enter their name, email and website, and then on the next they type in a quote and the app then posts all of this data to a database. I'm not sure how I can easily pass data from the first storyboard segue to the next, so that it can post all of the information to the database in one go. Thanks in advance for any replies.
Go to the storyboard. Select the single view controller by clicking on the title. In the drop-down menu, select Editor>Embed in>Tab Bar Controller. In this size class you can drag a drop and be pretty sure it will show correctly on a iPhone simulator.
Inside the DisplayViewController viewDidLoad method, you can set nameLabel. text = name . Now you have successfully pass data forward from one controller to another using prepareForSegue method.
Use the prepareForSegue:sender:
method to pass data from the source to destination view controller:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:...]) { MyViewController *controller = (MyViewController *)segue.destinationViewController; controller.myProperty1 = ...; controller.myProperty2 = ...; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With