当我使用以下代码设置tintcolor时,它可以正常工作
self.navigationController.navigationBar.tintColor = [UIColor brownColor];
但是当我尝试像-` UIImage *navigationBarCol = UIImage imageNamed:@“navigatorBar_color.png”这样设置色调颜色时;
self.navigationController.navigationBar.tintColor = UIColor带模式的颜色shade :navigationBarCol;`则不显示确切的颜色,仅显示黑色阴影。navigationBar_color.png是我想要设置的颜色的单像素图像。我正在使用这个方法在我的程序中设置表行或其他对象的颜色,它工作得很好。
此外,UIColor colorWithPatternImage方法应该返回UIColor,所以这两种方法在我看来也很相似。那么,您能告诉我为什么第二种方法不适用于navigatiorBar吗?
发布于 2010-01-17 12:48:27
NavigationBars和控件上的tintColor仅用作计算控件中使用的渐变的基础。你不可能有一个很好的渐变图像,所以它只是使用了其中的一部分。听起来您想要的是一个自定义的UINavigationBar子类,其中包含一个被覆盖的drawRect: method。
https://stackoverflow.com/questions/2079946
复制相似问题