一,效果图。
images/loading.gif' data-original="http://images2015.cnblogs.com/blog/337518/201510/337518-20151022133638755-1372507710.jpg" width="218" height="400" />
二,工程图。
三,代码。
AppDelegate.m
- (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;}
原标题:【代码笔记】自定义导航条颜色
关键词: