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

£可爱£侵袭症+ 提交于 2019-11-29 16:59:11

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.

Wenzhong

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.

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