最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2016年08月19日 08:59:04   投稿:daisy  
這篇文章介紹的是在IOS中怎樣把tabbar背景設置為透明,有需要的小伙伴們可以參考借鑒。

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

```
//  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實現(xiàn)自定義透明背景的tabbar的全部內(nèi)容,希望這篇文章對大家能有所幫助。

相關文章

最新評論

白山市| 富宁县| 石嘴山市| 定远县| 桃源县| 连南| 神木县| 法库县| 沈阳市| 岳普湖县| 望都县| 海伦市| 台东县| 娱乐| 独山县| 桂东县| 包头市| 榕江县| 公安县| 澳门| 宾川县| 平果县| 丰都县| 乌拉特中旗| 周口市| 东阿县| 华池县| 宁明县| 龙胜| 鲁山县| 托克逊县| 神木县| 克什克腾旗| 中江县| 杭锦旗| 凤阳县| 长宁县| 东城区| 安吉县| 汕尾市| 从江县|