移除tabBar 重影

 

-(void)viewWillLayoutSubviews{

    

    [super viewWillLayoutSubviews];

    

    for (UIView *child in self.tabBar.subviews) {

        

        if ([child isKindOfClass:NSClassFromString(@"UITabBarButton")]) {

            

            [child removeFromSuperview];

            

        }

        

    }

    

}

 

@interface BaseNavigationController ()

//<UINavigationControllerDelegate>

 

@end

 

@implementation BaseNavigationController

 

- (void)viewDidLoad {

    [super viewDidLoad];

    self.navigationBar.translucent = NO;

    self.automaticallyAdjustsScrollViewInsets = NO;

    self.navigationBar.barTintColor =  JRGBCOLOR(245, 246, 247);     //设置导航栏字体样式

    self.navigationBar.tintColor = JRGB(0xa4a4a4);

    [self.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:17.0f],NSForegroundColorAttributeName:[UIColor blackColor]}];

//    self.delegate = self;

}

- (void)pushViewController:(UIViewController *)viewController

                  animated:(BOOL)animated

{

    if (self.viewControllers.count > 0) {

        viewController.hidesBottomBarWhenPushed = YES;

    }

    [super pushViewController:viewController animated:animated];

}

//- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated

//{

//    // 删除系统自带的tabBarButton

//    for (UIView *tabBar in self.tabBarController.tabBar.subviews) {

//        if ([tabBar isKindOfClass:NSClassFromString(@"UITabBarButton")]) {

//            [tabBar removeFromSuperview];

//        }

//    }

//}

- (void)didReceiveMemoryWarning {

    [super didReceiveMemoryWarning];

}

原文地址:https://www.cnblogs.com/wq-gril/p/7211876.html