2011-11-02 34 views
0

我有幾個按鈕的根視圖,我想切換不同的標籤欄控制器,當點擊每個按鈕。我怎樣才能做到這一點?如何在應用程序中使用多個標籤欄控制器?

我做了第一個'Denetim Formu'按鈕。點擊它顯示第二張照片。但我怎麼能這樣做其他'Lokasyon,Taahhüdname,形式Sorgulama,等'按鈕。每個都必須顯示不同的標籤欄控制器。

enter image description hereenter image description here

+0

你有什麼試過?此外,這聽起來像一個奇怪的經歷 - 你能想出一個不那麼震撼的不同設計嗎? – bryanmac

+0

我上面編輯了我的問題,你現在可以看看嗎? –

回答

0

你能做的就是在你的特定按鈕點擊: - 1)你想哪個標籤欄按鈕項目,其視圖控制器改變(識別它)。

*YourViewController* *import=[[[*YourViewController* alloc]initWithNibName:@"*YourViewControllerNibName*" bundle:nil] autorelease]; 

    UINavigationController *baseNav = [[[UINavigationController alloc] initWithRootViewController:import]autorelease]; 
    NSArray *arr=[[appDelegate tabBarController]viewControllers]; 
    NSMutableArray *array=[NSMutableArray arrayWithArray:arr]; 
    [array replaceObjectAtIndex:1 withObject:baseNav]; 
    [[appDelegate tabBarController]setViewControllers:array]; 
    appDelegate.tabBarController.selectedIndex=1; 

    UITabBarItem *item= [[[[appDelegate tabBarController]tabBar]items ]objectAtIndex:1]; 
    item.image=[UIImage imageNamed:@"hometab.png"]; 
    [email protected]"Home"; 

通過這種方式,您可以更改您的標籤欄視圖控制器選項卡及其項目名稱和圖像。

+0

我不想更改tabbar的selectedIndex。我想顯示另一個不同的標籤欄控制器。 –

相關問題