Reputation: 283
I want to remove the bottom border from UINavigationBar
, but I don't know how to remove it.
Upvotes: 1
Views: 4135
Reputation: 3118
Actually, that is the shadow of the navigation bar.
To get rid of it, just set it to an empty image:
navigationController.navigationBar.shadowImage = UIImage()
Note: You must set it to an empty UIImage()
; nil
won't work for some reason.
Upvotes: 5
Reputation: 9983
For iOS 11 you can use the (deprecated) Black Translucent Navigation bar style with a custom bar tint.
Upvotes: 0
Reputation: 230
You need to set a custom shadow image to show instead of the default one. Note: a custom background image must also be set.
navController.navigationBar.barTintColor = .blue //set your color
navController.navigationBar.isTranslucent = false
navController.navigationBar.setBackgroundImage(UIImage(), for: .default)
navController.navigationBar.shadowImage = UIImage()
Upvotes: 2
Reputation: 747
you can do this
self.navigationController.navigationBar.layer.borderWidth = 0.0;
OR
you can give border color same as navigation bar background color
self.navigationController.navigationBar.layer.borderColor = [UIColor colorWithRed:<#(CGFloat)#> green:<#(CGFloat)#> blue:<#(CGFloat)#> alpha:<#(CGFloat)#>];
Upvotes: 0