iOS 把tabbar背景设置为透明
2016-08-18 00:00
525 查看
// UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, tabBarHeight + 5)]; // [imageView setImage:[self createImageWithColor:[UIColor clearColor]]]; // [imageView setContentMode:UIViewContentModeScaleToFill]; // [self.tabBar insertSubview:imageView atIndex:0]; //覆盖原生Tabbar的上横线 // [[UITabBar appearance] setShadowImage:[self createImageWithColor:[UIColor clearColor]]]; //背景图片为透明色 // [[UITabBar appearance] setBackgroundImage:[self createImageWithColor:[UIColor clearColor]]]; self.tabBar.backgroundColor = [UIColor clearColor]; //设置为半透明 self.tabBarController.tabBar.translucent = YES;
-(UIImage*) createImageWithColor:(UIColor*) color { CGRect rect=CGRectMake(0.0f, 0.0f, 1.0f, 1.0f); UIGraphicsBeginImageContext(rect.size); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [color CGColor]); CGContextFillRect(context, rect); UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return theImage; }
相关文章推荐
- IOS 设置TableViewCell背景透明
- iOS设置UITableViewCell的背景色透明和设置选中背景颜色的方法
- IOS开发教程--如何去除tabbar顶部线条及设置背景图片
- iOS开发- UITabBarController的TabBar、TabBarItem背景颜色设置
- iOS - 如何去除tabbar顶部线条及设置背景图片
- iOS将系统tabbar设置为透明
- iOS - 设置TabBarItem被选中时的背景
- ios webview gif背景为透明设置
- iOS - 设置NavigationBar的背景为透明
- IOS让标题栏背景透明、设置左右baritem
- iOS平台设置系统状态栏(通知栏、顶部状态栏)样式背景颜色或透明
- iOS 设置tabBar点击后Item的背景颜色.
- ios 设置webview透明背景
- iOS ViewController设置背景透明
- IOS实现自定义透明背景的tabbar
- iOS开发-设置tabBar的背景图片
- iOS ----- navigationController.navigationBar 设置背景透明
- ios怎么设置view背景透明
- iOS - 如何去除tabbar顶部线条及设置背景图片
- iOS UIWebView 设置背景颜色透明