My root view controller has an array that I want to save (using core data) whenever
applicationDidEnterBackground How can I send a message to an example of the Root View Controller in the delegate? I have set the representative as the root, when the controller was thinking about giving a reference to see, but it seems ineligible, is there a better way to do this?
1) In your RootViewController .h file,
+ ( RootViewController *) Shared Store; 2) In your RootViewController .m file,
+ (RootViewController *) shared store {Static RootviewController * myStore = Zero; If (! Mystore) {myStore = [[rootweek controller alloc] init]; } My return return; } 3) Go to your AppDelegate.m file and import your RootViewController
#import RootViewController.h < P> 4) In your AppDelegate.m file, go to the ApplicationDidEnterBackground method and type: [[RootviewControler ShareStore] saveChanges]; 5) Apply the SaveChanges method in RootViewController.
No comments:
Post a Comment