Set background color for UINavigationBar

前端 未结 9 590
滥情空心
滥情空心 2020-12-18 07:07

I want to develop UINavigationBar and also set background color for that. I have created the UINavigationBar but I have problem with setting backgr

相关标签:
9条回答
  • 2020-12-18 07:35
    self.navigationController.navigationBar.tintColor = [UIColor blackColor];
    
    0 讨论(0)
  • 2020-12-18 07:37

    Try this:

    navigationBar.tintColor = [UIColor blackColor];
    
    0 讨论(0)
  • 2020-12-18 07:39

    You can customize a UINavigationBar with the following propertys:

    • @property(nonatomic, assign) UIBarStyle barStyle
    • @property(nonatomic, retain) UIColor *tintColor
    • setBackgroundImage:forBarMetrics:
    • @property(nonatomic, copy) UIColor *backgroundColor

    For more methods and propertys please check the class reference of UINavigationBar and UIView

    0 讨论(0)
  • 2020-12-18 07:45

    In the new iOs this it how it works:

    self.navigationController.navigationBar.barStyle  = UIBarStyleBlackOpaque;
    self.navigationController.navigationBar.barTintColor =[UIColor colorAzulNavegacion];
    
    0 讨论(0)
  • 2020-12-18 07:48

    You could use the tint property of the UINavigationBarto change it's color. Check this article about it. There is also UIAppearance, that allows you to change the background of every UINavigationBar of your application, which is quite powerfull in my opinion. You can check this.

    0 讨论(0)
  • 2020-12-18 07:50

    You can set the tint color by using navbar.tintColor = [UIColor redColor];

    See the reference here: apple docs

    0 讨论(0)
提交回复
热议问题