How to transfer an object between views using a storyboard

I have 2 views controlled by the tab bar view controller created by the Xcode 4 template, which produces using a storyboard.

My first view on the first tab is the data entry page, my second view on the second tab displays this data. I have an object where the first view stores this data. How can I not only pass this object to the second view, but also make sure that it is updated when someone changes one of the UIText fields in the first view?

Thank you very much

+4
source share
1 answer

Place the data object in the delegate property of the application or in a global variable. In the data entry page view controller, add an IBAction method for each text field. In the action method, update the corresponding field of the data object. In the storyboard, connect each text field "Editing Did End" or "Value Changed" to the corresponding IBAction method.

+2
source

Source: https://habr.com/ru/post/1383248/


All Articles