@IBOutlet var navBar: UINavigationBar!
self.navBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navBar.shadowImage = UIImage()
The code above works if the View Controller is embedded in a Navigation Controller and uses self.navigationController?.navigationBar.setBack
... etc, but it doesn't work when using an IBOutlet (my example is not embedded in nav controller). The navigation bar is not translucent.
Any ideas?
Put this in you view controller (not in the uinavigationbar).
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];
Where exactly are you calling the appearance settings for a NavBar? When I try the following:
[self.myNC.navigationBar setShadowImage:[UIImage new]];
[self.myNC.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
I have the desired effect.Could you provide us with a little more context perhaps?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With