iOS 更改导航栏背景颜色

ios7以下的版本设置导航栏背景颜色可以使用

[[UINavigationBar appearance] setTintColor:[UIColor orangeColor]];

ios7以后:

[[UINavigationBar appearance] setBarTintColor:[UIColor orangeColor]];

默认带有一定透明效果,可以使用以下方法去除系统效果

[navigationController.navigationBar setTranslucent:NO];

公司项目需要将状态栏的文字颜色设置为白色,以下方法即可

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

改变后需要及时刷新的调用

[viewController setNeedsStatusBarAppearanceUpdate];

如果没有效果,需要在plist文件里设置

View controller-based status bar appearance  = NO

时间: 2024-08-04 13:20:06

iOS 更改导航栏背景颜色的相关文章

iOS 设置导航栏的颜色和导航栏上文字的颜色

#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface AppDelegate () @end

ios 修改导航栏的颜色

UINavigationBar *bar = [UINavigationBar appearance]; [bar setBarTintColor:[UIColor blueColor]]; // 修改导航栏的颜色为蓝色 [bar setBarStyle:UIBarStyleBlack]; [bar setTintColor:[UIColor whiteColor]]; // 字体的颜色为白色 [bar setTranslucent:NO];

IOS 自定义导航栏背景

//- (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; -(id)init { self=[super init]; if(self) { UINavigationBar *navBar=[self navigationBar]; if([navBar respondsTo

iOS 更改导航栏返回button文字

假如有两个ViewController A,B 改动B的返回button需在A页面设置 self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];

iOS 更改导航栏返回按钮文字

假如有两个ViewController A,B 修改B的返回按钮需在A页面设置 self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];

自定义iOS导航栏背景,标题和返回按钮文字颜色-----转载自gyz413977349

在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更改一下背景和颜色,代码会很简单,不需要很复杂的自定义View来替代leftBarItem 更改导航栏的背景和文字Color 方法一: [objc] view plaincopy //set NavigationBar 背景颜色&title 颜色 [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:20/255.

更改导航栏的背景和文字Color

更改导航栏的背景和文字Color方法一: [objc] view plaincopy//set NavigationBar 背景颜色&title 颜色  [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:20/255.0 green:155/255.0 blue:213/255.0 alpha:1.0]];  [self.navigationController.navigationBar

自定义iOS7导航栏背景,标题和返回按钮文字颜色

转自:http://blog.csdn.net/mad1989/article/details/41516743 在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更改一下背景和颜色,代码会很简单,不需要很复杂的自定义View来替代leftBarItem 更改导航栏的背景和文字Color 方法一: [objc] view plaincopy //set NavigationBar 背景颜色&title 颜色 [self.navigationController.na

【转】自定义iOS7导航栏背景,标题和返回按钮文字颜色 -- 不错不错!!

原文网址:http://blog.csdn.net/mad1989/article/details/41516743 在iOS7下,默认导航栏背景,颜色是这样的,接下来我们就进行自定义,如果你仅仅是更改一下背景和颜色,代码会很简单,不需要很复杂的自定义View来替代leftBarItem 更改导航栏的背景和文字Color 方法一: [objc] view plain copy //set NavigationBar 背景颜色&title 颜色 [self.navigationController