如何获得iOS 10手表导航栏的颜色和透明度? [英] How can I get the color and translucency of the iOS 10 watch Navigation Bar?

查看:83
本文介绍了如何获得iOS 10手表导航栏的颜色和透明度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望获得iOS 10手表导航栏的透明度和颜色.我通过选择RGB来管理颜色,但是我无法弄清半透明性.我正在使用Swift 3,有人可以告诉我如何获得透明性吗?我已经圈了我要寻找的透明性.

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.

请提供代码.

推荐答案

使用以下方法实现navigationBar translucent effect.当UIContentView滚动为您发布的图片时.

Use below method to achieve navigationBar translucent effect. When UIContentView scrolls as the picture you posted.

在viewDidLoad中:

  view.backgroundColor = UIColor.black
  navigationController?.navigationBar.barStyle = UIBarStyle.blackTranslucent
  navigationController?.navigationBar.tintColor = UIColor.white

已更新

输出:

注意:

  • 屏幕记录未显示真实结果.我建议您在真实设备中测试代码.

  • Screen recording is not showing the real result.I recommend you to test the code in a real device.

您可以使用相同的方法.如果您开发基于tabBar的项目.

You can use the same method. If you developing tabBar based project.

这篇关于如何获得iOS 10手表导航栏的颜色和透明度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆