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

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

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

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

```
//  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)容,希望這篇文章對大家能有所幫助。

相關(guān)文章

最新評論

武川县| 辉县市| 赤峰市| 利川市| 原阳县| 民权县| 白朗县| 华池县| 凉城县| 牙克石市| 邛崃市| 定结县| 十堰市| 民丰县| 清远市| 和平区| 北川| 贞丰县| 出国| 广河县| 洪雅县| 江达县| 娄底市| 大关县| 确山县| 福海县| 滨海县| 石泉县| 屏南县| 惠安县| 西和县| 体育| 乌拉特中旗| 察隅县| 漳浦县| 福建省| 临洮县| 淳化县| 木里| 贵港市| 山东省|