我有一个TabBarController与4 Tab . 当我从选项卡中推送ViewController时,选项卡会自动隐藏,并且在View中不显示任何内容 . 但ViewController包含一个包含数据的tableview . 我也实现了tableview委托 . 我没有得到tableview委托日志 .
在appdelegate didFinishLaunchingWithOptions()
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.homeScreen = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.rootNav = [[UINavigationController alloc]initWithRootViewController:self.homeScreen];
self.window.rootViewController = self.rootNav;
[self.window makeKeyAndVisible];
在这里加载TabBar:
myAppDelegate.myTabBarController.selectedIndex = 0;
myAppDelegate.myTabBarController.tabBar.translucent = NO;
myAppDelegate.myTabBarController.tabBar.opaque = YES;
location_select *tab1 = [[location_select alloc] initWithNibName:@"location_select" bundle:nil];
tab1.tabBarItem.image = [UIImage imageNamed:@"Restaurants.png"];
location_select *tab2 = [[location_select alloc] initWithNibName:@"location_select" bundle:nil];
tab2.title = @"Cart";
tab2.tabBarItem.image = [UIImage imageNamed:@"Cart.png"];
Deal_ViewController *tab3 = [[Deal_ViewController alloc] initWithNibName:@"Deal_ViewController" bundle:nil];
tab3.title = @"Deals";
tab3.tabBarItem.image = [UIImage imageNamed:@"Deals.png"];
MoreViewController *tab4 = [[MoreViewController alloc] initWithNibName:@"MoreViewController" bundle:nil];
tab4.title = @"More";
tab4.tabBarItem.image = [UIImage imageNamed:@"More.png"];
myAppDelegate.myTabBarController.viewControllers = [NSArray arrayWithObjects:tab1,tab2,tab3,tab4,nil];
[myAppDelegate.rootNav pushViewController:myAppDelegate.myTabBarController animated:YES];
从Tab 4,我推送Profile_ViewController:
Profile_ViewController *vc = [[Profile_ViewController alloc] initWithNibName:@"Profile_ViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:vc animated:YES];
我已经申请了:
myAppDelegate.myTabBarController.hidesBottomBarWhenPushed=NO;
and
[self.tabBarController setHidesBottomBarWhenPushed:NO];
在Profile_ViewController的viewWillAppear中 . 没有任何作品 . 我只看到一个空白的白色屏幕 .
2 回答
这是与您的查询相关的解决方案,可能对您有所帮助
您可能将您的架构保持如下导航控制器--->标签栏控制器 - > 4个子视图控制器
您需要执行此选项卡栏控制器 - > 4个子控制器(这4个子视图控制器中的每一个都有自己的导航控制器) .