2012-09-13 13 views
0

我在管理多個UINavigationControlller時遇到問題。使用多個UINavigationController和只有一個UITabBarController

我有一個UITabBar和在每個標籤我有一個單獨的UINavigationController。所以,如果我通過

tabBar.selectedIndex = i; // where i is index of tabbar. 

UITabBar切換,當我再回到前一個標籤由

tabBar.selectedIndex = previousIndex; 

我去UINavigationController的根源,不是我以前留下的視圖 - 控制。

我想轉到視圖控制器,從中跳轉到另一個選項卡,而無需調用-viewDidLoad:-viewWillAppear:

我需要一種方法,顯示UINavigationController或我的viewController。每當ü嘗試切換標籤

- (BOOL)tabBarController:(UITabBarController *)tbc shouldSelectViewController:(UIViewController *)viewController { 

} 

你的appDelegate類指定爲您tabbarcontroller的delagate

+0

這是UITabBar的默認功能,除非我們做任何更改以顯示rootView ...你可能在tabBarDelegate中寫了一些東西來顯示rootView .. – vishy

+0

you us usi ng [來自[this]的任何tabbarDelegate方法(https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSTabViewDelegate_Protocol/Reference/Reference.html),那麼請分享代碼 –

+0

好吧,我是檢查我的tabbardelegate。 @vishy – user1667626

回答

0

你AppDelegate.m文件執行時,下面的方法將被解僱

即( TabBarController.delegate = self)在appDidFinishLaunching方法

+0

現在工作的傢伙。 – user1667626

相關問題