更改UINavigationBar的颜色(Change color of UINavigationB

2019-08-01 02:57发布

你好,

我创建UINavigationBar ,我试图改变颜色条水上颜色(如笔尖文件)

我该怎么做?

Answer 1:

[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:0 green:.62 blue:.984 alpha:1]];

哥们,试试这个让[UIColor Aqua]在您的应用程序。



Answer 2:

您能设置tintColorbackgroundImageUINavigationBar

- (void) viewDidLoad
{
   //set background image
   [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"background.png"]];

  //OR set background Color
  [self.navigationController.navigationBar setTintColor:[UIColor blueColor]];
}

我不知道,但如果你把这个在你的应用程序的第一次调用方法可能适用于无处不在!

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


Answer 3:

试试这个,

UINavigationController *navigationController;
UIColor* aqua = [UIColor colorWithRed:0 green:1 blue:1 alpha:1];
navigationController.navigationBar.tintColor = [UIColor aqua];

问候



Answer 4:

UINavigationBar *bar = [self.navigationController navigationBar];
[bar setTintColor:[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]];

请尝试设置的颜色上面的代码。

编辑

 UINavigationBar *bar = [self.navigationController navigationBar];
UIColor* aqua = [UIColor colorWithRed:0 green:1 blue:1 alpha:1];
[bar setTintColor:aqua];

此代码中使用了呈浅绿色



Answer 5:

[self.navigationController.navigationBar setTintColor:[UIColor blueColor]];

调用此函数以前生产的ViewController会出现,例如,在viewDidLoad:



文章来源: Change color of UINavigationBar