// // RQTabBarController.m // RQCommon // // Created by 张嵘 on 2018/11/14. // Copyright © 2018 张嵘. All rights reserved. // #import "RQTabBarController.h" #import "RQTabBar.h" @interface RQTabBarController () /// tabBarController @property (nonatomic, strong, readwrite) QMUITabBarViewController *tabBarController; @end @implementation RQTabBarController - (void)viewDidLoad { [super viewDidLoad]; self.tabBarController = [[QMUITabBarViewController alloc] init]; /// 添加子控制器 [self.view addSubview:self.tabBarController.view]; [self addChildViewController:self.tabBarController]; [self.tabBarController didMoveToParentViewController:self]; // kvc替换系统的tabBar RQTabBar *tabbar = [[RQTabBar alloc] init]; //kvc实质是修改了系统的_tabBar [self.tabBarController setValue:tabbar forKeyPath:@"tabBar"]; } #pragma mark - Ovveride - (BOOL)shouldAutorotate { return self.tabBarController.selectedViewController.shouldAutorotate; } - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return self.tabBarController.selectedViewController.supportedInterfaceOrientations; } - (UIStatusBarStyle)preferredStatusBarStyle { return self.tabBarController.selectedViewController.preferredStatusBarStyle; } - (BOOL)prefersStatusBarHidden{ return self.tabBarController.selectedViewController.prefersStatusBarHidden; } @end