用的UITabBar部分透明背景 [英] UITabbar with partially transparent background

查看:481
本文介绍了用的UITabBar部分透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很长一段时间的读者,首次海报。请温柔:P

Long time reader, first time poster. Please be gentle :P

我工作的一个应用程序,并拥有该是透明的顶部几个像素的UITabBar元素的背景图像。我已搜查远播,尝试了许多解决方案,建议我能找到(设置色调,背景色为clearColor,设置阿尔法0.2等),但我仍然看到一条黑线,其中的TabBar应该是透明的。我设置背景如下(见注释了一些更多的东西我都试过,没有工作线)

I'm working on an app and have a background image for a UITabbar element that is transparent for a few pixels at the top. I have searched far and wide, tried many solutions suggested that I could find (setting tint, background color to clearColor, setting alpha to 0.2, etc) but I continue to see a black line where the tabbar should be transparent. I am setting the background as follows (see the lines commented out for some more things I have tried which did not work)

//[[UITabBar appearance] setBackgroundColor:[UIColor clearColor]];
//[self.view setBackgroundColor:[UIColor clearColor]];
//[super.view setBackgroundColor:[UIColor clearColor]];
//UITabBar.super.setBackgroundColor:[UIColor clearColor]];
[[UITabBar appearance] setBackgroundColor:[[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:0.2]];
//[[UITabBar appearance] setTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTintColor:[[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:0.1]];
//[[UITabBar appearance] setAlpha:0.0];// setTintColor:[UIColor magentaColor]];
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"tabbar.png"]];

截图可以在 http://i.imgur.com/m1tW5.png 是源泉


  • 应用程序使用一个tabbarcontroller。

  • 当我设置背景颜色为白色或其他颜色,黑线改变颜色成功,但只要我设置颜色为clearColor黑线回来。

  • 当我隐藏整个标签栏有什么疯狂的背后,我可以看到成功霜背景我应该。

  • 的图像与在那里如前面提到的黑线出现一个透明的顶部有一个PNG。

有没有人有什么我可以做错了什么建议?

Does anyone have any suggestions on what I could be doing wrong?

帮助将是真正的AP preciated。

Help will be truly appreciated.

编辑:我使用的是iOS 5.0和不关心支持previous IOS版本(在打开任何额外的潜在选择的情况下)

I am using iOS 5.0 and don't care about supporting previous iOS versions (in case that opens up any additional potential choices).

推荐答案

我决定去与我碰到其他地方黑客十岁上下的解决方案。

I decided to go with a "hack-ish" solution I came across elsewhere.

我使用的颜色作为背景相同的标签栏的背景图像的领域建立透明的假象。不是真正透明的,但是这就是我能想出后这个花了无数时间是最好的。

I'm using the same color as the background in areas of the tab bar's background image to create the illusion of transparency. Not really transparent but that's the best I could come up with after countless hours spent on this.

也许那将是对于在未来类似的立场,以及其他人的解决方案。

Maybe that'll be a solution that works for someone else in a similar position in the future as well.

这篇关于用的UITabBar部分透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆