[英]How to Change Navigation Bar Color
I need give a custom color to my navigation bar.But I am not intended to use an image.Is there any way to change the navigation bar color other than using an image.Please help. 我需要给导航栏自定义颜色,但是我不打算使用图像,除了使用图像外,还有什么方法可以改变导航栏颜色。 Thanks in advance.
提前致谢。
您可以使用RGB值制作颜色,并将其设置到导航栏。
yourNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.31 green:0.66 blue:0.83 alpha:1.00];
In objective C and In IOS 7 navigation bar has a property 在目标C和IOS 7中,导航栏具有一个属性
in your view controller.h file make a property of your navigationbar like this. 在视图controller.h文件中,像这样创建导航栏的属性。
@property (weak, nonatomic) IBOutlet UINavigationBar *mynavbar;
And in your viewcontroller.m file call that this method change your navigationbar color. 在您的viewcontroller.m文件调用中,此方法更改了导航栏的颜色。
mynavbar.barTintColor=[UIColor groupTableViewBackgroundColor];
thanks in advance. 提前致谢。
navBar.navigationBar.barTintColor = [UIColor blueColor];
// barTintColor sets the background color
navBar.navigationBar.tintColor = [UIColor whiteColor];
// tintColor sets the buttons color of the navigation bar
navBar.navigationBar.translucent = NO;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.