I want to remove the bottom border from UINavigationBar
, but I don't know how to remove it.
Asked
Active
Viewed 4,052 times
1

Natalie Hedström
- 2,607
- 3
- 25
- 36

Socheat
- 283
- 1
- 4
- 11
-
5Possible duplicate of [How to hide iOS7 UINavigationBar 1px bottom line](http://stackoverflow.com/questions/19226965/how-to-hide-ios7-uinavigationbar-1px-bottom-line) – Roy Falk Jan 22 '16 at 09:03
4 Answers
5
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.

doplumi
- 2,938
- 4
- 29
- 45
-
The documentation says it would just work when setting the backgroundImage with, but it worked for me without the backgroundImage as the code in this answer – thacilima Oct 25 '18 at 14:40
2
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()

G. Veronika
- 232
- 2
- 11
0
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)#>];

Rushi trivedi
- 737
- 1
- 15
- 37
0
For iOS 11 you can use the (deprecated) Black Translucent Navigation bar style with a custom bar tint.

rockdaswift
- 9,613
- 5
- 40
- 46