使iOS 8.1中的下方图像的导航栏透明 [英] Make navigation bar transparent regarding below image in iOS 8.1

查看:122
本文介绍了使iOS 8.1中的下方图像的导航栏透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将导航栏设置为透明,如下图所示:

I try to set my navigation bar transparent regarding a image below this, something like the following image :

我在透明导航栏ios 但是我没有得到上面的结果,我只得到左侧的图标但导航栏中没有任何颜色,完全没有透明。但如果我设置背景颜色,透明度就会消失。

I tried the solution in transparent navigation bar ios but I don't get the above result, I get only the icon on the left but without any color in the navigation bar, completely transparent. But if I set a background color the transparency disappears at all.

有没有办法在导航栏中设置颜色并使其透明?

There is any way to set a color in the navigation bar and make it transparent??

谢谢你提前。

推荐答案

只需在8.1模拟器上查看并获得与您的图片非常相似的结果

just checked on the 8.1 simulator and got very similar result to your picture

    let bar:UINavigationBar! =  self.navigationController?.navigationBar

    bar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
    bar.shadowImage = UIImage()
    bar.backgroundColor = UIColor(red: 0.0, green: 0.3, blue: 0.5, alpha: 0.3)

这里的要点是背景颜色与alpha。

main point here is background color with alpha.

检查附图,也许我错过了什么?

Check attached image, maybe I missed something?

这篇关于使iOS 8.1中的下方图像的导航栏透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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