Question

I want to remove the horizontal separator line between a UITabBar and the rest of the screen. I'm asking the same question as this guy but updated for iOS7.

Setting the background image of my UITabBar doesn't alleviate the problem, nor does setting the background image of the [UITabBar appearance] object.

Is this still possible in iOS7? If so, how?

Was it helpful?

Solution 3

The answer to this is pretty much the same as removing the separator of a navigation bar or a toolbar.

Officially, this is only possible by setting the shadowImage to an empty image. However, a closer look at the documentation, we see that:

For a custom shadow image to be shown, a custom background image must also be set using the backgroundImage property. If the default background image is used, then the default shadow image will be used regardless of the value of this property.

By using a custom background image, you would lose the blurred background translucency.

The separator is a UIImageView that is a subview of the tab bar. You can find it in the tab bar's hierarchy and set it to hidden.

OTHER TIPS

You could also hide shadow line using this code:

[self.tabBar setValue:@(YES) forKeyPath:@"_hidesShadow"];

Swift

self.tabBar.setValue(true, forKey: "_hidesShadow")

This solution uses a transparent image, so it is more preferable.

Swift

tabBar.shadowImage = UIImage()

Objective-C

tabBar.shadowImage = UIImage.new; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top