RTRootNavigationController
RTRootNavigationController copied to clipboard
不能直接使用self.navigationController获取tabBarItem吗?
NSLog(@"%@--%@",self.rt_navigationController,self.navigationController);
<JPNavigationController: 0x7faa22046800>--<RTContainerNavigationController: 0x7faa2205ec00>
self.navigationController.tabBarItem.badgeValue = nil;
我是写了个JPNavigationController 继承你的导航控制器 但是使用self.navigationController获取不到tabBarItem,所以设置不能设置tabBarItem.badgeValue,使用self.rt_navigationController就行
直接:
self.tabBarItem.badgeValue = @"3";
就好,取决于 vc 是怎么放到 tab 中的
self.tabBarItem.badgeValue = @“ 3 ” ; 并不能解决,vc是用addChildViewController 添加到tab 利用UIViewController *vc = [self.tabBarController.viewControllers objectAtIndex:1]; vc.tabBarItem.badgeValue = nil; 可以解决 why??
tabBarController 不能通过 addChildViewController 的方式,只能 setViewControllers: 。完整代码方便贴下吗
已经使用了[self setViewControllers:@[nav,nav1,nav3]];还是一样的效果 NSLog(@"%@--%@",self.rt_navigationController,self.navigationController); 打印结果 <JPNavigationController: 0x7faa22046800>--<RTContainerNavigationController: 0x7faa2205ec00>
你的 nav nav1 nav3 是什么类型?
JPNavigationController继承你的RTRootNavigationController
这样确实只能用 self.rt_navigationController
@rickytan
Notice(Only for below v0.6)
RTRootNavigationController
- RTContainerViewController | - RTContainerNavigationController
| - YourViewController1 - RTContainerViewController
- RTContainerNavigationController - YourViewController2
看到你提示这个堆栈结构是低于v0.6的,那v0.6.3的堆栈结构有变化吗?
结构没有变,只是通过 self.navigationController.viewControllers 也可以拿到相邻的 vc 了,之前不可以的,永远返回一个