On iOS 10 this code doesn't work in order to remove the tabBar shadow line:
[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];
Somebody knows, what must I do to remove it?
On iOS 9.3
with this two lines the line is removed, but iOS 10
ignores setShadowImage
command.
Just try to bellow code for iOS 10 :-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UITabBar appearance] setBackgroundImage:[UIImage imageNamed:@"fondoTabBar"]];
[UITabBar appearance].layer.borderWidth = 0.0f;
[UITabBar appearance].clipsToBounds = true;
return YES;
}
Swift 3.x
UITabBar.appearance().layer.borderWidth = 0.0
UITabBar.appearance().clipsToBounds = true
Just the 2 lines removes the topline
tabBar.shadowImage = UIImage()
tabBar.backgroundImage = UIImage()
For iOS 10 changed tabbar style to black did the trick
self.tabBarController.tabBar.shadowImage = UIImage()
self.tabBarController.tabBar.barStyle = .Black
I had the same problem in ios 10. I fixed this issue just changing the height of UITabBar (by default is 49). Check it here how to change the height.
You should implement the following two methods at the same time:
[[UITabBar appearance] setShadowImage:[UIImage new]];
[[UITabBar appearance] setBackgroundImage:[UIImage new]];
If you create your own subclass of UITabBarController, you can set the
values in viewDidLoad like this
Swift 3
override func viewDidLoad() {
super.viewDidLoad()
self.tabBar.layer.borderWidth = 0
self.tabBar.clipsToBounds = true
}
It's a shadow image (property) of tabbar. Try following solutions and see.
Try this,
** Objective-C **
//Remove shadow image by assigning nil value.
[[UITabBar appearance] setShadowImage: nil];
// or
// Assing UIImage instance without image reference
[[UITabBar appearance] setShadowImage: [[UIImage alloc] init]];
** Swift **
//Remove shadow image by assigning nil value.
UITabBar.appearance().shadowImage = nil
// or
// Assing UIImage instance without image reference
UITabBar.appearance().shadowImage = UIImage()
Here is apple guideline for shadowImage.
@available(iOS 6.0, *)
open var shadowImage: UIImage?
Default is nil. When non-nil, a custom shadow image to show instead of
the default shadow image. For a custom shadow to be shown, a custom
background image must also be set with -setBackgroundImage: (if the
default background image is used, the default shadow image will be
used).