I makes the navigation bar completely transparent by adding the following codes in viewWillAppear:
self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.translucent = true
self.navigationController?.navigationBar.barStyle = UIBarStyle.Black
Before the current view disappear, I reset the navigation bar by doing this in the viewDidDisappear method:
self.navigationController?.navigationBar.setBackgroundImage(nil, forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = nil
but it turns out the little bottom line of the navigation bar is missing, here is the image that shows the normal navigation bar:
but it turns out being like this:
any idea about what is going on? and any solutions? thanks
A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.
The appearance settings for a standard-height navigation bar when the edge of scrollable content aligns with the edge of the navigation bar.
A Boolean value that indicates whether the navigation bar is translucent.
it's missing because you set shadow image to nil. To fix this, delete line below :
self.navigationController?.navigationBar.shadowImage = nil
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