[iOS 导航与TabBar混合] UINavigationCon+UITabBarViewController 混合使用
2016-08-09 15:00
459 查看
一般我们
都是用一个根导航控制器
说白了, 其实整个app里面 就有一个导航控制器
如果 _window.rootViewController = 是TabBarControllerd 的子类 呢?
我这里记录下写法,仅供自己翻阅
我想应该很明白, 首先我有三个ViewController 作为视图
其次, 我使用三个继承自UINavigationController的导航控制器,
让这三个视图控制器 分别 加入到 三个 导航控制器中.
让 _window.rootViewController = tabBarC;
于是,我们就得到这个GIf
然后,我们给上图的按钮们(bottom1,bottom2,bottom3,bottom4) 分别添加方法,让他们分别push到各自的视图中,从而验证我的疑惑,
目前,我拥有三个导航控制器了,他们如果各自push 那么各自的导航条肯定不变,各自管各自的
[备注:由于没录制到 bottom1的时候 是进入红色的,特此说明]
那么,如果我用Bottom4来实现, 导航1 push 到导航2 下面的控制器,会出现什么情况???
看到,不管是什么viewCOntroller 只要从各自的导航push过去,那么 此viewController的导航控制器就是来自上一个,
不会因为之前被push过以后而 保持以前的样式,
因此,我感觉 如果以TabBarController 为RootViewController
那么,里面的每一项 都应该是 各自管各自的 不然, 会不会混乱啊“` 哈哈 自己的猜想
最后,蛋疼的事情来了, 我从设计那边拿来的图 自带文字, 尺寸并不标准,so. 连tabBarViewController 都要自定义了 奶奶的
_window.rootViewController = ???
都是用一个根导航控制器
说白了, 其实整个app里面 就有一个导航控制器
如果 _window.rootViewController = 是TabBarControllerd 的子类 呢?
我这里记录下写法,仅供自己翻阅
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. [IQKeyboardManager sharedManager]; PayViewController *payC = [[PayViewController alloc] init]; PayNavigationController *payNav = [[PayNavigationController alloc] initWithRootViewController:payC]; payNav.tabBarItem.image = [UIImage imageNamed:@"缴费-正常"]; payNav.tabBarItem.selectedImage = [UIImage imageNamed:@"缴费-选中"]; SearchViewController *searchC = [[SearchViewController alloc] init]; SearchNavigationController *sarchNav = [[SearchNavigationController alloc] initWithRootViewController:searchC]; sarchNav.tabBarItem.image = [UIImage imageNamed:@"查询-正常"]; sarchNav.tabBarItem.selectedImage = [UIImage imageNamed:@"查询-选中"]; AccountViewController *accountC = [[AccountViewController alloc] init]; AccountNavigationController *accountNav = [[AccountNavigationController alloc] initWithRootViewController:accountC]; accountNav.tabBarItem.image = [UIImage imageNamed:@"我的-正常"]; accountNav.tabBarItem.selectedImage = [UIImage imageNamed:@"账户-选中"]; FlowCardBarController *tabBarC = [[FlowCardBarController alloc] init]; tabBarC.viewControllers = @[payNav,sarchNav,accountNav]; tabBarC.tabBarController.view.height = 140; _window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; _window.rootViewController = tabBarC; [_window makeKeyWindow]; return YES; }
我想应该很明白, 首先我有三个ViewController 作为视图
其次, 我使用三个继承自UINavigationController的导航控制器,
让这三个视图控制器 分别 加入到 三个 导航控制器中.
让 _window.rootViewController = tabBarC;
于是,我们就得到这个GIf
然后,我们给上图的按钮们(bottom1,bottom2,bottom3,bottom4) 分别添加方法,让他们分别push到各自的视图中,从而验证我的疑惑,
目前,我拥有三个导航控制器了,他们如果各自push 那么各自的导航条肯定不变,各自管各自的
就像这样
[备注:由于没录制到 bottom1的时候 是进入红色的,特此说明]
那么,如果我用Bottom4来实现, 导航1 push 到导航2 下面的控制器,会出现什么情况???
情形如下
看到,不管是什么viewCOntroller 只要从各自的导航push过去,那么 此viewController的导航控制器就是来自上一个,
不会因为之前被push过以后而 保持以前的样式,
因此,我感觉 如果以TabBarController 为RootViewController
那么,里面的每一项 都应该是 各自管各自的 不然, 会不会混乱啊“` 哈哈 自己的猜想
最后,蛋疼的事情来了, 我从设计那边拿来的图 自带文字, 尺寸并不标准,so. 连tabBarViewController 都要自定义了 奶奶的
相关文章推荐
- iOS学习之第二个View使用UITabBarViewController
- iOS 隐藏tabBar UITabBarController 以及 于UINavigationController 配合使用 push
- IOS UITabBarViewController 和UINavigationController 结合使用
- iOS -App主流框架UINavigationController && UITabBarController的简单使用
- IOS学习之第二个View使用UITabBarViewController
- IOS研究之UITabBarController隐藏tabBar以及addChildViewController
- iOS开发之UITabBarController和UICollectionView的使用
- [iOS]UINavigationController UITabBarController UITableView学习笔记
- iOS开发-自定义TabBar使用popToRootViewControllerAnimated重叠问题解决
- iOS开发之UITabBarController和UICollectionView的使用
- ios UINavigationController(导航控件)的使用
- 使用UITabBarViewCOntroller时隐藏tabbar
- iOS -App主流框架UINavigationController && UITabBarController的简单使用
- iOS-UI篇—UITabBarController控制View的生命周期(使用storyoard搭建
- iOS学习之第二个View使用UITabBarViewController
- 【深入浅出IOS开发】UITabBarController和UINavigationController混合使用
- IOS学习之第二个View使用UITabBarViewController
- iOS学习之第二个View使用UITabBarViewController
- [iOS]UINavigationController UITabBarController UITableView学习笔记
- iOS自定义TabBar使用popToRootViewControllerAnimated重叠问题解决