iOS 如何去掉Tabbar上的黑线

不啰嗦,直接上代码:

CGRect rect = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width);

UIGraphicsBeginImageContext(rect.size);

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);

CGContextFillRect(context, rect);

UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

[tabbar.tabBar setBackgroundImage:img];

[tabbar.tabBar setShadowImage:img];

[tabbar.tabBar setBackgroundColor:[UIColor whiteColor]];(如果不加上这行代码,你的tabbar的颜色是透明的.如果你是自定义的背景视图,可以在上方的setBackgroundImage添加你自定义的图片)

你可能感兴趣的:(iOS 如何去掉Tabbar上的黑线)