国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 尉氏县| 淮阳县| 高要市| 清镇市| 龙井市| 安化县| 驻马店市| 贵定县| 确山县| 深泽县| 北流市| 玛多县| 敦煌市| 兴山县| 临颍县| 无锡市| 彭山县| 四川省| 泰安市| 盘锦市| 姚安县| 天峨县| 石城县| 吴堡县| 肇州县| 青河县| 偏关县| 邻水| 柳州市| 雷山县| 驻马店市| 潢川县| 开原市| 波密县| 三原县| 丹东市| 枣阳市| 和静县| 江西省| 光山县| 临沭县|