[英]UITabBar fully transparent
In XCode I am using the interface builder (StoryBoard) to lay out most of my layout. 在XCode中,我使用界面构建器(StoryBoard)来布局我的大部分布局。 However I want some custom drawing on this.
但是我想要一些自定义绘图。 This works quite well.
这非常有效。
There is however a problem what I am facing. 然而,我面临着一个问题。 I have a "bite" out of the active tab.
我在活动标签中有一个“咬”。 (see http://cl.ly/Efno ) I want this bite fully transparent.
(参见http://cl.ly/Efno )我希望这一口完全透明。 (I have set an pink background color to see what part I want transparent which is not transparent.)
(我设置了一个粉红色的背景颜色,看看我想透明哪个部分不透明。)
How I have changed the look and feel is the following. 我如何改变外观和感觉如下。
In the awakeFromNib of that class I have set the label position and image and selected image of each tabbar item. 在该类的awakeFromNib中,我设置了每个tabbar项的标签位置和图像以及所选图像。 Like so
像这样
[tabBarItem setFinishedSelectedImage:selectedImage withFinishedUnselectedImage:image];
Each image fully covers the entire tabbar in height and has the width of the tab item itself. 每个图像完全覆盖整个标签栏的高度,并具有标签项本身的宽度。
However, it is not transparent, the pink part is black. 但是,它不透明,粉红色部分是黑色的。 How can I make this transparent?
我该如何透明?
Thanks 谢谢
Have a look at the appearance proxy for UITabBar, you might be able to do what you want there without having to use a custom subclass. 看看UITabBar的外观代理,您可以在不使用自定义子类的情况下执行您想要的操作。 There are tons of properties you can access and change.
您可以访问和更改大量属性。 You could set the relevant properties in the app delegate.
您可以在应用程序委托中设置相关属性。 It is iOS5 only though, but I gather that you are using that already, since you mentioned storyboards.
虽然它只是iOS5,但我认为你已经使用了它,因为你提到了故事板。
Eg 例如
UIImage *tabBarBackground = [UIImage imageNamed:@"tabBarBackground.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor colorWithRed:127.0/255.0 green:186.0/255.0 blue:235.0/255.0 alpha:1.0]];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabBarItemSelected.png"]];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.