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

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

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

2019-10-21 18:53:08
字體:
供稿:網(wǎng)友

話不多說,直接看示例代碼

```//  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的全部內(nèi)容,希望這篇文章對(duì)大家能有所幫助。


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到IOS開發(fā)頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 霍山县| 平邑县| 苏尼特左旗| 繁峙县| 靖州| 兰考县| 永和县| 乐陵市| 商都县| 连江县| 酒泉市| 铅山县| 礼泉县| 临安市| 屯昌县| 漠河县| 天等县| 温宿县| 武清区| 文登市| 嘉禾县| 冷水江市| 会东县| 盈江县| 马关县| 尼木县| 蕲春县| 垦利县| 宜春市| 新蔡县| 西城区| 定南县| 沿河| 化州市| 红河县| 定边县| 巴楚县| 万荣县| 苏尼特右旗| 武宁县| 陇西县|