[問題] Tabbar的切換問題

作者: psheaven (瑪尼愛我)   2014-05-28 16:06:59
各位好,初學不久想請教關於TabBar的問題,不使用storyboard建立,都用獨立Xib來做
先建立了4個頁面,1個是UITabbarController,3個是UIViewController
在AppDelegate內先寫code
將UIViewController都用UINavigationController包起來,想要讓每一頁都能有導航列
執行後三個BarItem能正常切換頁面
接著想要在page2的部份做成,點下tablerow即可用navigation push到下一個tabbar
這邊有兩個page的Tabbar,也都用NavigationController包著
如附圖... http://ppt.cc/eGII
跑出來的樣子如右下,背景全黑,且一進去切換到的頁面是在第二頁><
也沒有出現能回到上一頁的導航列...
請各位前輩幫幫忙,感激不盡~~~~
附上點擊TableRow的這段code
---------------
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
TBTView2_1* vc1 = [TBTView2_1 new];
UINavigationController* nvc1 = [[UINavigationController
alloc]initWithRootViewController:vc1];
TBTView2_2* vc2 = [TBTView2_2 new];
UINavigationController* nvc2 = [[UINavigationController
alloc]initWithRootViewController:vc2];
vc1.title = @"VC2-1";
vc2.title = @"VC2-2";
nvc1.title = @"NVC 2-1";
nvc2.title = @"NVC 2-2";
self.tabBarController.viewControllers = [NSArray arrayWithObjects:nvc1,
nvc2, nil];
[self.navigationController pushViewController:self.tabBarController
animated:YES];
}
我的想法是用原本建立的TabBarController作修改,然後push過去...
可是失敗了Orz
作者: tentenlee (天天)   2014-05-28 16:22:00
log不是寫很清楚 你沒有view呀... 單然都黑的
作者: darktt (小朱)   2014-05-28 16:53:00
你要多建立一個新的TabViewController,不能使用原本的原本的TabBar就將它藏起來就好我按照你的作法做了一個相同的專案,你看看中間的差異吧http://ppt.cc/YLRy

Links booklink

Contact Us: admin [ a t ] ucptt.com