iphone - Propagating data among view controllers -
I have a table view controller, some lines on the table, to open the new controller, to enter more data or to picker the user Let it happen, etc. It's just like the built-in calendar app when the user taps "save" on the second screen, so I want to back up the value from that screen into the table view controller, but I do not know how to do this. Since I'm using pushNavigationController to access the second screen, there is no chance to provide a pointer back to the original object. (It really looks like a bad design, even though the other controller needs to know about his parents.)
In addition, by testing, it seems that the controlling controller originates the ' Do not stop 'controller so that you do not resume on the next line of code once the second screen is popped up.
It seems that I'm really missing something original.
Many of Apple's frameworks support MVC (Model View Controller) design pattern. The controller (in this case UITableViewController) sees the audiocats for the acquisition of data (in this case a UITableView). To take full advantage of this method, your data should come from a model object. This is an object that you design to represent your data - providing an abstract so that your UI is being attached and your data is loose when your controller data is another way to inspect or edit If the controller pushes, the model controller is passed to this controller so that the new controller can access the data contained in the model. The data changes in the user UI and then when "save" is pressed, the model object is modified.
There are several ways to promote the change back to the UITableViewController by pressing "Save" button. You can use KVO (looking at key value) by which the asset of the model object varies when the table Or any of its cells is notified. Another way is to use NSNotificationCenter notifications to communicate changes between two controllers.
Comments
Post a Comment