- Notification. But you don't want this.
- You can get the reference to your that
viewController
in the AppDelegate
. Than call that (void)goToBeginning
method in the (void)applicationDidEnterBackground
For example: In your ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.myViewController = self;
}
And in your AppDelegate
:
@class MyViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (weak, nonatomic) MyViewController *myViewController;
@end
And in the AppDelegate
's implementation:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[self.myViewController goToBeginning];
}