【问题标题】:Translucent UINavigationBar not working properly on iOS 12 beta (GM seed)半透明 UINavigationBar 在 iOS 12 测试版(GM 种子)上无法正常工作
【发布时间】:2018-09-13 21:29:33
【问题描述】:

我在 iOS 12 上遇到了半透明 UINavigationBar 的问题。

在 UINavigationController 中,当我“推送”具有半透明 UINavigationBar 的 UIViewController 时,UINavigationBar 上的过渡动画效果不佳,并且不再透明并且顶部为黑色,带有 alpha。 我使用的在 iOS 11.0 上运行良好的代码是在 UINavigationBar 上设置半透明的常用代码

UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().backgroundColor = .clear
UINavigationBar.appearance().isTranslucent = true

是否有人有相同的用例来检查问题是否也发生?

【问题讨论】:

    标签: swift ios12


    【解决方案1】:

    相反,您为什么不使用实用程序区域将其设置为半透明?

    【讨论】:

    • 对不起,如果这没有帮助。
    • 你的意思是来自界面构建器还是什么?
    • 这是实用区域 - 您可以在那里编辑大多数设计内容
    • 在项目中,我们为 UIViewController 使用单独的 xib,我们想要一些更全局的解决方案来设置它,并且上面的代码之前可以工作。
    • 问题是,如果你有一些应用程序之前使用过半透明,并且它在 iOS 12 beta 上的行为是否正确
    猜你喜欢
    • 1970-01-01
    • 2020-08-02
    • 2019-05-15
    • 2014-11-05
    • 1970-01-01
    • 2012-01-29
    • 2015-07-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多