简体   繁体   中英

How to pass object between views with a storyboard Created Tab Bar Controller

I have 2 views controlled by a tab bar view controller created by the template Xcode 4 gives out using the storyboard.

My first view on the first tab is a data entry page, my second view on the second tab graphs this data. I have an object where the first view stores this data. How do I not only pass this object to my second view but also ensure it gets updated when someone changes one of the UITextfields on the first view?

Many thanks

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM