- (void)changeTabBar {
//不透明
self.tabBar.translucent=NO;
CGRectrect =CGRectMake(0,0,KScreenWidth,49);
UIGraphicsBeginImageContext(rect.size);
CGContextRefcontext =UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [[UIColorclearColor]CGColor]);
CGContextFillRect(context, rect);
UIImage*img =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.tabBa rsetBackgroundImage:img];
[self.tabBar setShadowImage:img];
}
原理:其实并没有删除横线,只是把它变成透明了。
网友评论