我试图创建一个应用程序,其中选项卡栏透明(或看起来透明)。为此,我在视图中使用了图像的一部分。并将剩余部分设置为选项卡栏的背景。问题是选项卡栏显示的阴影较深。我现在没主意了。下面是屏幕截图

UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tabbar_bg.png"]];
self.tabBar.backgroundColor=[UIColor whiteColor];
[self.tabBar insertSubview:imgView atIndex:1];
// [self.tabBar setSelectionIndicatorImage:[UIImage imageNamed:@"transp.png"]];
// [self.tabBar setSelectedImageTintColor:[UIColor clearColor]];
[[UITabBar appearance] setTintColor:[UIColor clearColor]];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor clearColor]];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"transp.png"]];上面是我在自定义UITabBarController类的viewDidLoad中试用过的代码。
谢谢你的帮助。
发布于 2014-09-08 19:39:25
试一试
[self.tabBar setBackgroundImage:[UIImage new]];这个技巧也适用于UINavigationBar。
发布于 2013-09-11 08:03:40
你有没有试过创建它的子类?
@implementation TabBarInvisible
-(id)init
{
self = [super init];
if (self)
{
self.opaque = NO;
self.backgroundColor = [UIColor clearColor];
self.backgroundImage = nil;
}
return self;
}
-(void)drawRect:(CGRect)rect
{
}
@endhttps://stackoverflow.com/questions/14848361
复制相似问题