我正在使用该类别来自定义导航栏。我的代码是:
- (void) drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents([self.tintColor CGColor]));
CGContextFillRect(context, rect);
}
它工作得很好,但在 iOS 5 中不行。我需要导航栏颜色是纯色的,没有任何渐变。我该怎么做?
据我所知,对于 iOS 5,替换drawRect
方法的唯一方法是创建一个子类,但是有没有办法让所有导航控制器都使用UINavigationBar
子类而不是原始类?