【发布时间】:2017-01-13 14:48:35
【问题描述】:
我们在AppDelegate 中有一个UINavigationViewController 作为根viewController:
Restore *callRestore=[[Restore alloc]initWithNibName:@"Restore" bundle:nil];
self.navigationController = [[UINavigationController alloc] initWithRootViewController:callRestore];
self.window.rootViewController = self.navigationController;
我们正在从上方恢复一个新的viewController (TabViewController):
callTabView=[[TabViewController alloc] initWithNibName:@"TabViewController" bundle:nil];
[self.navigationController pushViewController:callTabView animated:YES];
在这个TabViewController 中,我们以编程方式添加UITabBarController 作为子视图,在这个UITabBarController 中,我们有5 个UINavigationBarController 作为视图控制器:
NSArray* controllers = [NSArray arrayWithObjects:navControllerDashboard, navControllerAccounts, navControllerTransation,navControllerCallDisplayReports,navControllerMore, nil];
self.tabBarController.viewControllers = controllers;
self.tabBarController.delegate = self;
self.tabBarController.view.frame = self.view.frame;
[self.view addSubview:self.tabBarController.view];
当我们从这 5 个UINavigationViewController 中旋转任何视图时,在landscape 和portrait 模式下,我们都会在顶部获得2 个UINavigationBar。
查看下图。
并且 didRotateFromInterfaceOrientation 并没有从这 5 个 UINavigationViewController 视图中调用。
有什么帮助吗?
【问题讨论】:
-
callTabView 是 UIViewController。我们正在初始化 tabBarController 并像这样添加 tabBarController: self.tabBarController = [[UITabBarController alloc] init]; [self.view addSubview:self.tabBarController.view];
标签: ios objective-c iphone uitabbarcontroller uinavigationbar