有兩種方法:
1.在AppDelegate中添加
[[UITabBar appearance] setShadowImage:[[UIImage alloc]init]];
[[UITabBar appearance] setBackgroundImage:[[UIImage alloc]init]];
2.在tabbarVC中添加
其實(shí)并沒(méi)有刪除橫線(remove掉)猾警,只是把它變成透明的不影響操作和界面美觀而已(視覺(jué)錯(cuò))
CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor);
CGContextFillRect(context, rect);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self.tabBar setBackgroundImage:img];
?[self.tabBar setShadowImage:img];