lucgian841
lucgian841

Reputation: 2002

Get instance of view controller in AppDelegate.m

In my app I've three view controller embedded in a UITabBarController. The second view controller embed a table view controller. Now I've this bug: I go to the second view controller, then I press home button and the app goes in background. When the app is closed I receive a push notification, so when I open the app it shows me the second view controller with table view without any changes. How I can update the table view automatically? For now I'm using the UIRefreshControl, but I will do it automatically, how I can do that?

Upvotes: 0

Views: 185

Answers (1)

Mayank Jain
Mayank Jain

Reputation: 5754

You can get your VC's instance from storyboard. First you have to set storyboard ID to your VC

UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
YourViewController *vc =  [storyBoard instantiateViewControllerWithIdentifier:@"YourViewControllerID"]; // here YourViewControllerID is storyboard Id of your VC.

Upvotes: 2

Related Questions