In my notification did receive method, I want the app to go to the selected tab and display the root view controller of the tab.
I tried the following implementation bu开发者_运维技巧t the selected tab did not display the root view controller. How can I make this work?
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
self.tabController.selectedIndex = 2;
//Pop View Controller to root
[self.tabController.selectedViewController.navigationController popViewControllerAnimated:NO];
}
Try
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
self.tabController.selectedIndex = 2;
//Pop View Controller to root
[self.tabController.selectedViewController.navigationController popToRootViewControllerAnimated:NO];
}
精彩评论