小编Ant*_*nov的帖子

UINavigationBar,纯色iOS 5

我正在使用该类别来自定义导航栏.我的代码是:

- (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子类而不是原始类?

uinavigationbar customizing ios5

3
推荐指数
1
解决办法
7584
查看次数

标签 统计

customizing ×1

ios5 ×1

uinavigationbar ×1