开发者

tintcolor for navigationBar

When I set the tintcolor using following code it works

self.navigationController.navigationBar.tintColor = [UIColor brownColor];

But When I try to set the tint color like - ` UIImage *navigationBarCol = [UIImage imageNamed:@"navigatorBar_color.png"];

self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:navigationBarCol]; ` Then it does not show the exact color and only shows a shade of black. navigationBar_color.png is a single pixel image of the color I want to set. I am using this method to set the color of table rows or other objects in my program and it works fine.

Moreover UIColor colorWithPatternImage method is supposed 开发者_开发问答to return UIColor so both the approach also look similar to me. Can you please tell me then why does the second approach does not work well for navigatiorBar.


The tintColor on NavigationBars and controls is only used as the basis to calculate the gradient used in the control. You can't very well have a gradient image, so it's just using part of it. It sounds like what you want is a custom subclass of UINavigationBar, with an overridden drawRect: method.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜