i'm trying to remove the navigationBar border in swift. This is done by using following code in objective-c:
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]
How can this be done in swift?
i've tried this, but not working:
UINavigationBar.appearance().shadowImage = UIImage(named: "")
UINavigationBar.appearance().setBackgroundImage(UIImage(named: ""), forBarMetrics: UIBarMetrics.Default)
To change the background, text and icons colors, and also remove the border/shadow of the navigation bar via the appearance proxy, insert this code in the
didFinishLaunchingWithOptions:
ofAppDelegate
:Note: As you can see, we need to convert the
UIColor
toUIImage
, so you can use this extension:Use it like this:
UIColor.redColor().toImage()
I have used the below code to remove the navigation bar shadow from the app.
Try this: