If you just want to use a solid navigation bar color and have set this up in your storyboard, use this code in your
AppDelegate
class to remove the 1 pixel border via the appearance proxy:
Objective-C
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init]
forBarPosition:UIBarPositionAny
barMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
Swift 3.x
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
NOTE: must set isTransluscent
UINavigationBar instance to false
to avoid transparent navigation bar; either in storyboard or in code
navigationController?.navigationBar.isTranslucent = false
// or
navigationBar.isTranslucent = false
The problem with this method is that. The 1px points disappears but flickers later.
To reproduce : Set navigation bar to a color and set the ViewController background as the same color.
Make app go to background, open from background. The 1px point line will flicker.