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