[问题] 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