Nit*_*x88 23
您可以通过将此代码弹出到具有导航栏的类中来删除渐变并设置自己的纯色.您可以将UIColor更改为您需要的任何颜色.请注意,此代码需要在另一个实现之外,因此无论您放在哪个.m文件中,都要将它放在已在该文件中实现的类的@implmentation之前.
@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
UIColor *color = [UIColor blueColor];
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents( [color CGColor]));
CGContextFillRect(context, rect);
}
@end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7541 次 |
| 最近记录: |