开发者

How can I get a 'matte' color on a UINavigationBar?

开发者 https://www.devze.com 2023-03-29 23:08 出处:网络
How can I get a matte color on a UINavigationBar instead of the shiny look? [self.navigationController.navigationBar setTintColor:[UIColor blackColor]]开发者_如何学编程;

How can I get a matte color on a UINavigationBar instead of the shiny look?

[self.navigationController.navigationBar setTintColor:[UIColor blackColor]]开发者_如何学编程;


There's no built-in way to do this. Using tintColor will always get you the default "shiny" look. The alternative is to draw the bar yourself, using the technique described here, to get the look you want.


My simple way using category UINavigationBar:

@implementation UINavigationBar (UINavigationBarWithoutShiny)
- (void)drawRect:(CGRect)rect {}
@end

after this i can use just background color of UINavigationBar view:

self.navigationController.navigationBar.backgroundColor = [UIColor greenColor];
0

精彩评论

暂无评论...
验证码 换一张
取 消