首页 > 代码库 > 自定义导航条的颜色

自定义导航条的颜色

 

才发现,导航条的颜色是可以进行修改的。

 

#import "AppDelegate.h"#import "RootViewController.h"@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];    // Override point for customization after application launch.        RootViewController *rootVC=[[RootViewController alloc]init];    UINavigationController *nav=[[UINavigationController alloc]initWithRootViewController:rootVC];       // UIBarMetricsDefault:用竖着(拿手机)时UINavigationBar的标准的尺寸来显示UINavigationBar.    //UIBarMetricsLandscapePhone:用横着时UINavigationBar的标准尺寸来显示UINavigationBar    [nav.navigationBar setBackgroundImage:[UIImage imageNamed:@"1.jpg"] forBarMetrics:UIBarMetricsDefault];        self.window.rootViewController=nav;                self.window.backgroundColor = [UIColor whiteColor];    [self.window makeKeyAndVisible];    return YES;}