【设置导航栏颜色/图片、文字颜色】
设置导航栏颜色会同时设置标题栏背景色
//设置导航栏背景颜色 nc.navigationBar.barTintColor = [UIColor whiteColor]; //设置导航栏背景图片 nc.navigationBar.barTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"image.jpg"]]; //设置导航栏文字颜色 nc.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];以上情况用于UIviewController外部设置,当在内部时,可以用
self.navigationController代替上面的“nc”对象
如
self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
【设置标题栏文字颜色】
首先,将项目info选项中的最后一项下拉选中最后一项

,然后,在appdelegate中设置
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [UIApplication sharedApplication] .statusBarStyle = UIStatusBarStyleLightContent; // Override point for customization after application launch. return YES; }
搞定
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/179297.html原文链接:https://javaforall.net
