I created this class to configure every view controller to avoid redundancy inside viewdidload().
class Configuration: UIViewController {
func setNavigationTheme(#backgroundImage: String, dashboardImage: String) {
self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: dashboardImage), forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.tintColor = UIColor.whiteColor()
let bgImage: UIImage = UIImage(named: backgroundImage)!
self.view.backgroundColor = UIColor(patternImage: bgImage)
}
}
inside viewDidLoad()
var configure = Configuration()
configure.setNavigationTheme(backgroundImage: "Background", dashboardImage: "Dashboard")
When I call the function, it does not change anything, am I doing it wrong or not?