Reputation: 3956
The project's initial viewController is a UITabBarViewController, I want to push a new viewController when received a remote notification, but not sure now which viewController is in, how to deal with it?
Upvotes: 1
Views: 56
Reputation: 12717
You can easily determine which UIViewController
is visible currently, see below, considering code is written in AppDelegate
to access UIWindow
property directly
UITabBarController *tabController=(UITabBarController *)self.window.rootViewController;
UINavigationController *selectedNav=(UINavigationController *)tabController.selectedViewController;
UIViewController *viewControllerVisible=[[selectedNav viewControllers] lastObject];
Then upto you what you want to do.
Hope this helps.
Cheers.
Upvotes: 2