目标C:Tabbar控制器:如何选择选项卡并将视图集弹出为root?

时间:2011-07-19 07:32:46

标签: objective-c ios uitabbarcontroller rootview

在我的通知确实收到方法,我希望应用程序转到选定的选项卡并显示选项卡的根视图控制器。

我尝试了以下实现,但所选标签未显示根视图控制器。我怎样才能做到这一点?

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    self.tabController.selectedIndex = 2; 

    //Pop View Controller to root
   [self.tabController.selectedViewController.navigationController popViewControllerAnimated:NO];     
}

1 个答案:

答案 0 :(得分:0)

尝试

-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
    self.tabController.selectedIndex = 2; 

    //Pop View Controller to root
   [self.tabController.selectedViewController.navigationController popToRootViewControllerAnimated:NO];     
}