I want to make a reddish translucent UINavigationBar (for iOS9), and I found that the following codes are essential:
navController.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
navController.navigationBar.shadowImage = UIImage()
navController.navigationBar.backgroundColor = UIColor(red: 1.0,green: 0.3,blue: 0.3,alpha: 0.9)
navController.navigationBar.translucent = true
It works fine if I simply created a UINavigationBar (instead of creating a UINavigationController), but it looks like this as I created a UINavigationController.
enter image description here
I found the culprit to be the line navController.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default)
, but if I remove it, the bar looks like this:
enter image description here So how can I solve this problem? (I'm creating the UINavigationController programmatically and sorry for the inconvenience that I cannot imbed images)