【问题标题】:How to change the background color of the TabBar to translucence in iOS6如何在iOS6中将TabBar的背景颜色更改为半透明
【发布时间】:2014-01-27 13:00:02
【问题描述】:

我的UITabBarController 是从UITabBarController 扩展而来的,iOS7 的背景颜色是半透明的,但在 iOS6 中是黑色的。 iOS6中如何将背景色改为半透明

【问题讨论】:

    标签: ios iphone objective-c ios6 ios7


    【解决方案1】:

    您可以设置透明图像

    UIImage* tabBarBackground = [UIImage imageNamed:@""];
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
    [[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"trans.png"]];
    

    查看链接

    tab bar contrller

    【讨论】:

    • 很好的帮助没有 Transpernt 我无法设置 uicolor
    【解决方案2】:

    您是否尝试过使用自定义颜色的 tint 属性,例如

    [[UITabBar appearance] setTintColor:[[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:0.5]];
    

    【讨论】:

      【解决方案3】:

      有很多方法,但默认在iOS7

      [tabBar setTranslucent:YES]; 所以你有 tabBar 的半透明背景但是在iOS6 你手动做

      [tabBar setTranslucent:YES];
      

      试试吧,也试试 @Retro's 的答案,另一个选择是

      [self.tabBarController.tabBar setBackgroundColor:[UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.6]];
      

      【讨论】:

        【解决方案4】:

        你可以设置如下。

         [self.tabBarController.tabBar setBackgroundColor:
         [UIColor  whiteColor]];
         [self.tabBar setBackgroundColor:[UIColor whiteColor]];
         [self.tabBarController.tabBar setTranslucent:NO]; 
         [self.tabBar setTranslucent:NO];
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-07-15
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-06-11
          • 1970-01-01
          相关资源
          最近更新 更多