设置TabBar文字的选中颜色和未选中颜色
// 设置未选中文字颜色
[[UITabBar appearance] setUnselectedItemTintColor:[UIColor colorWithHexString:@"#535353"]];
// 设置选中文字颜色
[[UITabBar appearance] setTintColor:[UIColor colorWithHexString:@"#DF0615"]];
push页面的时候,会闪一下黑色
- (TODO:生成gif图)
- 在自定义的NavigationController中的
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
方法中,添加以下代码
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
// 解决Push页面时候,导航栏会闪一下黑色
self.view.backgroundColor = [UIColor whiteColor];
[super pushViewController:viewController animated:animated];
}
iOS 14 push多个控制器,返回到根控制器,发现tabbar消失的问题
- 在自定义的NavigationController中的
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
;方法中,当子控制器的数量大于1时,设置如下代码
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.childViewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
// 解决push多个控制器后,popToRootViewController TabBar消失
if (self.childViewControllers.count > 1) {
viewController.hidesBottomBarWhenPushed = NO;
}
}
[super pushViewController:viewController animated:animated];
}
网友评论