I implemented a custom UITabBar and I still have this gradient/shadow on top of it. I added
[self.tabBar setBackgroundImage:[UIImage imageNamed:@"navBarBottom.png"]];
which is just changing the background but keeping the shadow gradient.
What am I doing wrong ? Is there anything to specify to get rid of it ?
What I have :
What I want :
Thank you.
Try this, ** Objective-C **
** Swift **
Here is apple guideline for shadowImage.
Swift
Try this for your custom tab bar. It will hide horizontal shadow line.
Objective C
Try setting a 1x1 pixel transparent shadow image for the UITabBar:
Try this on viewDidload.
It work for me
Calling
[[UITabBar appearance] setShadowImage:]
will customise allUITabBar
instances in your app.If you want to customize just one
UITTabBar
, you can do this:In your view controller or view controllers or BasicViewController that most of the viewcontrollers inherit in the viewDidLoad just put these 2 lines:
Be sure transparent_shadow@2x.png is an image 1x1 or 2x2 transparent and the tab_bar_background@2x.png is an image 640x100 as the bottom bar is 50px in height.
Works on iOS 9.3