Completely transparent UITabBar in iOS 8

I try to make my tabBar transparent, I searched, but all I found were articles, resulting in partially and not completely transparent tabBars, and some were for iOS 5, etc.

I would like to accomplish this as shown in Sketch 3:

enter image description here

What is the easiest way to accomplish this?

I thought about it:

// Make the tabBar transparent self.tabBarController.tabBar.backgroundColor = [UIColor clearColor]; self.tabBarController.tabBar.translucent = YES; 

but this result was not entirely ideal:

enter image description here

Really appreciate the help! :)

Regards, Erik

Update

 // Make the tabBar transparent [[UITabBar appearance] setBarTintColor:[UIColor clearColor]]; self.tabBarController.tabBar.translucent = YES; 
+7
ios objective-c transparent uitabbarcontroller uitabbar
source share
4 answers

Have you tried barTintColor ?

 [[UITabBar appearance] setBarTintColor:[UIColor clearColor]]; [[UITabBar appearance] setBackgroundImage:[UIImage new]]; 

That should do the trick.

+22
source share

Swift 3.0

... call this code in AppDelegate didFinishLaunchingWithOptions

 let tabBar = UITabBar.appearance() tabBar.barTintColor = UIColor.clear tabBar.backgroundImage = UIImage() tabBar.shadowImage = UIImage() 

The result will be a transparent background for each UITabBar.

+19
source share

You need to subclass UITabBarController and in viewdidload: you have to put this code:

 CGRect rect = CGRectMake(0, 0, 1, 1); UIGraphicsBeginImageContextWithOptions(rect.size, NO, 1.0); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, [UIColor clearColor].CGColor); CGContextFillRect(context, rect); UIImage *transparentImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [self.tabBar setBackgroundImage:transparentImage]; [self.tabBar setShadowImage:transparentImage]; // self.tabBar.alpha = 0.0; 
+6
source share

This easy solution fixed my problem:

 let size = CGSize(width: tabBar.bounds.size.width, height: tabBar.bounds.size.height) tabBar.backgroundImage = UIImage.jotImage(with: UIColor.clear, size: size) 
0
source share

All Articles