简体   繁体   中英

Change UINavigationBar Tint Color

Hi I am trying to change the tint color of a newly created navigation bar but i am having difficulty getting the tint color to change and have tried various ways of implementing tintColor . Here is how I am creating it.

UINavigationBar *navBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, 320, 64)];
    [navBar setTintColor:[UIColor redColor]];
    [settingsView addSubview:navBar];

Do I need to approach it differently or redraw it?

Can you try this,

[navBar setBarStyle:UIBarStyleBlackOpaque]; [navBar setTintColor:[UIColor redColor]];

iOS 7有一个名为setBarTintColor的方法可以很好地工作

为我工作完美!

  [self.homeNavigationBar setBarTintColor:[UIColor whiteColor]];

Try this:

[[UINavigationBar appearance] setBarTintColor:[UIcolor redcolor]];

use this code

UIColor *appcolor=[UIColor colorWithRed:63.0/255.0 green:148.0/255.0 blue:246.0/255.0 alpha:1.0];

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM