Remove gradient/Gloss from UITabBarItem

2019-09-04 12:49发布

问题:

I am customizing the UITabBar. I used my custom image in UITabBarItem. The problem is whether there is a gradient/gloss on the item. I checked Apple's app Store didn't had any of this glossy effect on its UITabBarItem. How can i remove gradient from UITabBarItem?

回答1:

You just need to put clear image as `yourImage', it may help you

[[UITabBar appearance] setSelectionIndicatorImage:[UIImage {yourImage}]]

Edit i just googled it and found lot of similar questions. You can also try below code of lines

[[UITabBar appearance] setShadowImage:[UIImage imageNamed:@"Tappbarimage.png"]];

You'll have to provide the images yourself to the UITabBarItem with using this tabbarMethod setFinishedSelectedImage:withFinishedUnselectedImage:.

There's no other way to affect the processing it does to the images besides changing the color of the gradient with UITabBar's selectedImageTintColor appearance property.