Guy S
Guy S

Reputation: 620

iOS transparent uitabbar not working

I'm trying to have transparent tabbar in my application so the user can see the uitableview behind the tabBar.

I've seen all the topics here and haven't succeded yet.

I have the following code in my AppDelegate:

UITabBar *tabBar = [self.tabBarController tabBar];

if ([tabBar respondsToSelector:@selector(setBackgroundImage:)])
{
    tabBar.opaque = NO;
    tabBar.alpha = 0.8;
    [[UITabBar appearance] setTintColor:[[UIColor alloc] initWithRed:0.0 green:0 blue:0 alpha:0.9]];
    [tabBar setBackgroundImage:[UIImage imageNamed:@"transparent-tabbar.png"]];    
}

I just don't succeded with disabling the default black background of the tab bar.

What am I missing?

By the way the file transparent-tabbar.png is: http://www.fastup.co.il/images/49382332.png

Thanks.

Upvotes: 2

Views: 3430

Answers (2)

Emon
Emon

Reputation: 462

May be you should try the change the background image of the tabbar items not tabbar black ground..May be it will help.I have not implemented it yet..

Upvotes: 0

Omar Abdelhafith
Omar Abdelhafith

Reputation: 21221

The problem here is not that you cant set the image, or that you cant get rid of the black color, the problem is in UITabBarController the viewcontrollers you add does not reach behind the UITabBar

So the problem that occurred that there is a black view bellow the UITabBar, so even if you remove the tabBar what you will see is a black view (try to set tabBar.hidden = YES;)

A workaround is to set the superView of tabBar to a color

tabBar.superview.backgroundColor = [UIColor whiteColor];

This would fix your problem

Upvotes: 2

Related Questions