This question already has an answer here:
I know there are duplicates of this question but my situation is different here.
When user goes back to the home (void)applicationDidEnterBackground
gets invoked from the AppDelegate
class. However once user presses home button, I don't want user to see this view controller again, so I have a method named (void)goToBeginning
that switches to another view controller. I want to be able to call this method from AppDelegate. I don't really want to use NotificationCenter
for this. Also the picked solution here:
Calling view controller method from app delegate
does not work for me as it initialises new object whereas I want to be able to call an object that is already in the view. How can I do that? I am using iOS 7 and XCode 5.
viewController
in theAppDelegate
. Than call that(void)goToBeginning
method in the(void)applicationDidEnterBackground
For example: In your
ViewController
And in your
AppDelegate
:And in the
AppDelegate
's implementation: