公告
财富商城
积分规则
提问
发文
2019-03-04 07:02发布
Root(大扎)
Hello,
I created UINavigationBar, and I try to change the color bar to aqua color (As in Nib file)
UINavigationBar
How do I do it?
try this,
UINavigationController *navigationController; UIColor* aqua = [UIColor colorWithRed:0 green:1 blue:1 alpha:1]; navigationController.navigationBar.tintColor = [UIColor aqua];
regards
UINavigationBar *bar = [self.navigationController navigationBar]; [bar setTintColor:[UIColor colorWithRed:0.5 green:0.5 blue:0.5 alpha:1.0]];
Please try above code for set color.
Edited
UINavigationBar *bar = [self.navigationController navigationBar]; UIColor* aqua = [UIColor colorWithRed:0 green:1 blue:1 alpha:1]; [bar setTintColor:aqua];
This Code use for the aqua color
[self.navigationController.navigationBar setTintColor:[UIColor blueColor]];
Call this function befor the ViewController will appear, e.g. in viewDidLoad:
viewDidLoad:
[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:0 green:.62 blue:.984 alpha:1]];
Dude, try this to get [UIColor Aqua] throughout your app.
[UIColor Aqua]
You can set either tintColor or backgroundImage to your UINavigationBar
tintColor
backgroundImage
- (void) viewDidLoad { //set background image [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"background.png"]]; //OR set background Color [self.navigationController.navigationBar setTintColor:[UIColor blueColor]]; }
I'm not sure but if you'll put this in first call method of your app it may apply everywhere!
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { }
最多设置5个标签!
try this,
regards
Please try above code for set color.
Edited
This Code use for the aqua color
Call this function befor the ViewController will appear, e.g. in
viewDidLoad:
Dude, try this to get
[UIColor Aqua]
throughout your app.You can set either
tintColor
orbackgroundImage
to yourUINavigationBar
I'm not sure but if you'll put this in first call method of your app it may apply everywhere!