国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > iOS > 正文

IOS實(shí)現(xiàn)自定義透明背景的tabbar

2020-07-26 03:16:10
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

話不多說(shuō),直接看示例代碼

```//  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];//設(shè)置為半透明  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實(shí)現(xiàn)自定義透明背景的tabbar的全部?jī)?nèi)容,希望這篇文章對(duì)大家能有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 铜鼓县| 青海省| 咸阳市| 高清| 英山县| 屏边| 新巴尔虎左旗| 霍林郭勒市| 曲阜市| 巴林右旗| 汾阳市| 屏边| 永春县| 晋州市| 东安县| 冀州市| 沙坪坝区| 集贤县| 榆中县| 仙桃市| 潢川县| 绵阳市| 柳江县| 高雄县| 斗六市| 曲麻莱县| 通渭县| 屯留县| 双桥区| 开原市| 正定县| 新邵县| 海门市| 井陉县| 广丰县| 乐都县| 固原市| 思南县| 汕尾市| 荆门市| 安国市|