0

在我的iPhone應用程序中,我使用的是UITabbarController + UINavigationController,創建於appDelegateUITabbarController + UINavigationController創建推送和彈出問題

我的問題是:

在畫面'我有tableview。當我選擇單元時,我將控制器推到屏幕B上。現在,如果我從tabbar中選擇另一個選項卡,則不會彈出它,然後view會刷新,但導航欄不會刷新。它顯示屏幕-Bscreen-B的導航欄。

使用下面的代碼,但似乎沒有解決我的問題:

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController 
    { 
     if ([viewController isKindOfClass:[UINavigationController class]]) 
     { 
      [viewController.navigationController popToRootViewControllerAnimated:NO]; 
     } 
    } 
+0

這聽起來像你重新使用導航控制器,如果是這樣,我認爲在更改其內容時,您必須明確更新其標題/欄。 但也許最好的事情是,如果你可以提供更多的代碼,那:) – d4Rk 2013-05-10 10:44:14

回答

1

嘗試這種在的appdelegate

UINavigationController *screen1=[[UINavigationController alloc] initWithRootViewController:controller1]; 

UINavigationController *Bscreen=[[UINavigationController alloc] initWithRootViewController:controller2]; 

NSArray *tabbararray=[[NSArray alloc] initWithObjects: screen1,Bscreen,nil]; 


self.TabControllerObj.viewControllers=allviewcontrollers; 

,使的TabBar作爲你的窗口的根視圖 - 控制

相關問題