How can I get the color and translucency of the iOS 10 watch Navigation Bar?

China☆狼群 提交于 2019-11-28 11:39:32

问题


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 tabBar based 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!