ios 改变系统UITabbar 和UINavigaitonbar的黑线的颜色

1. //改变标签栏横线颜色

NSArray  *tabArray=self.tabBarController.tabBar.subviews;

for ( id obj  in tabArray) {

if ([obj isKindOfClass:[UIImageView class]]) {

UIImageView *imageView=(UIImageView *) obj;

imageView.backgroundColor=View_ToolBar;

}

}

2.//改变导航条横线颜色

//给imgaeview 添加一个类别

+ (UIImage *)imageWithColor:(UIColor *)color size:(CGSize)size

{

CGRect rect = CGRectMake(0, 0, size.width, size.height);

UIGraphicsBeginImageContext(rect.size);

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context,

color.CGColor);

CGContextFillRect(context, rect);

UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return img;

}

//调用

[[UINavigationBar appearance] setShadowImage:[UIImage imageWithColor:tabBar_line size:CGSizeMake(kDeviceWidth, 1)]];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容