2014-11-25 53 views
0

我很想開發iOS應用程序。每個UIViewController在uitabbar(iOS)中都有自己的導航欄

我的申請流程是這樣的

它開始作爲naviagtion控制器再經過詳細頁面我使自定義標籤欄的窗口根控制器

現在我有3個標籤 每個標籤具有不同的UI

裝置具有

TAB1 - >表視圖

TAB2 - >網格視圖

TAB3 - >多個表

現在我想每個UI控制器必須有它自己的導航欄 並且還crossponds到標籤聯繫起來。

非常感謝您的寶貴意見。

+0

請做一個搜索和落實然後一些事情告訴我們您所面臨的問題。顯示你自己的一些努力。 – 2014-11-25 12:20:12

+0

@Zoain我只是問關於流程而不是代碼。 這樣做的最佳方式 – 2014-11-25 12:21:54

回答

0

只需使用三個導航控制器爲3個選項卡創建自定義選項卡欄控制器。

然後,每個導航控制器的根視圖控制器應該是您相應的視圖控制器。

爲了更好的理解,請查看此圖片。

enter image description here

編程方式從Tabbarcontroller方面

UINavigationController *navCont1; 
UINavigationController *navCont2; 

UITabBarController *yourTabbarcontroller; 

yourTabbarcontroller = [[UITabBarController alloc]init]; 




FirstViewController *viewCont1 = [[FirstViewController alloc]init]; 

navCont1= [[UINavigationController alloc]initWithRootViewController:viewCont1]; 

UITabBarItem *tab1 = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemBookmarks tag:1]; 

[viewCont1 setTabBarItem:tab1]; 



SecondViewController *viewCont2 = [[SecondViewController alloc]init]; 

navCont2= [[UINavigationController alloc]initWithRootViewController:viewCont2]; 

UITabBarItem *tab2 = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:2]; 

[viewCont2 setTabBarItem:tab2]; 



tab.viewControllers = [NSArray arrayWithObjects:navCont1,navnavCont2,nil]; 

self.window.rootViewController = tab; 
+0

然後在按下的選項卡上添加這些導航視圖控制器。我對嗎? – 2014-11-25 12:25:46

+0

請查看圖片 – 2014-11-25 12:26:45

+0

謝謝。還有一件事我使用xib。對不起,我不知道 ,但我是iOS開發新手。 – 2014-11-25 12:29:37

相關問題