UITabBarController与UINavigationController混合开发

##这种方式可以让你快速生成一个UITabBarController与UINavigationController的混合开发形式!

更加简洁页请看:https://www.jianshu.com/p/d2730568230b

######首先我们在入口类指定TabBarController

    #import"AppDelegate.h"

    #import"QWTabBarController.h"

    @interfaceAppDelegate()

    @end

    @implementationAppDelegate

    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

    self.window= [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];

    QWTabBarController*tabBar = [[QWTabBarControlleralloc]init];

    self.window.rootViewController= tabBar;

    [self.windowmakeKeyAndVisible];

    returnYES;

    }


######2.创建一个UINavigationController

.h

#import@interface QWNavitionController: UINavigationController

@end

.m

#import "QWNavitionController.h"

@interface QWNavitionController ()

@end

@implementation QWNavitionController

- (void)viewDidLoad {

[super viewDidLoad];

self.navigationBar.barTintColor = MAIN_COLOR;

[self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:20.0]}];

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

@end


######3.创建对应的UITabBarController


#define MAIN_COLOR RGB(233.0,82.0,82.0) 宏定义的颜色

你可能感兴趣的:(UITabBarController与UINavigationController混合开发)