Skip to content

Instantly share code, notes, and snippets.

@stakira
Last active June 12, 2016 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stakira/d8781c10f105ff93a6eb81e4d312b2d1 to your computer and use it in GitHub Desktop.
Save stakira/d8781c10f105ff93a6eb81e4d312b2d1 to your computer and use it in GitHub Desktop.
import Foundation
extension UIViewController {
func st_setNavigationBarTheme() {
if let nav = self.navigationController?.navigationBar {
// Colors
nav.translucent = false
nav.barTintColor = UIColor.whiteColor() // themeColor
nav.titleTextAttributes = [
NSForegroundColorAttributeName: UIColor.whiteColor()
]
// Remove shadow
let img = UIImage()
nav.shadowImage = img
nav.setBackgroundImage(img, forBarMetrics: UIBarMetrics.Default)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment