简体   繁体   中英

How to turn navigationBar back to nontransparent?

How do I change the navigationBar back to nontransparent in one view after I have made it transparent with this piece of code in AppDelegate.swift :

self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = UIImage()
self.navigationBar.translucent = true

have you tried:

self.navigationBar.setBackgroundImage(nil, forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = nil  
// or
self.navigationBar.barStyle = UIBarStyle.Default 

and of course:

self.navigationBar.translucent = **false**

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM