问题
I am looking to get the translucency and color of the iOS 10 watch navigation bar. I managed the color by color picking the RGB but I cannot figure out the translucency. I am using Swift 3, can anyone tell me how to get the translucency? I have circled what translucency I'm looking for.
Please provide the code if you can.
回答1:
Use below method to achieve navigationBar translucent effect. When UIContentView scrolls as the picture you posted.
In viewDidLoad:
view.backgroundColor = UIColor.black
navigationController?.navigationBar.barStyle = UIBarStyle.blackTranslucent
navigationController?.navigationBar.tintColor = UIColor.white
Updated
Output:
Note:
Screen recording is not showing the real result.I recommend you to test the code in a real device.
You can use the same method. If you developing
tabBarbased project.
回答2:
If you mean you want to get rid of translucent effect, just
Programatically:
navigationController?.navigationBar.isTranslucent = false
In Storyboard:
Just click on the navigation bar, and in attribute inspector, you'll find it.
来源:https://stackoverflow.com/questions/43419860/how-can-i-get-the-color-and-translucency-of-the-ios-10-watch-navigation-bar