swift - 背景颜色清晰的 UIToolbar 在 iOS 10 中变为白色

标签 swift xcode7 uitoolbar xcode-storyboard

我有一个 UIView,我在其中添加了一个 UIToolBar

我已经将背景色设置为清晰的颜色。它在 iOS 9 中运行良好,但在 iOS 10 中变为白色。除清晰颜色之外的任何其他颜色在 iOS 10 中都可以正常工作。

我正在使用 Xcode 7.3、storyboard 和 swift。

最佳答案

试试这个:

     @IBOutlet var mytab: UIToolbar!

    override func viewDidLoad() {
    super.viewDidLoad()

    let myImage = UIImage()


    mytab.setBackgroundImage(myImage, forToolbarPosition: .any, barMetrics: .default)
    mytab.isTranslucent = true

}

关于swift - 背景颜色清晰的 UIToolbar 在 iOS 10 中变为白色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40014580/

相关文章:

ios - 当 NavigationController 更改 View 时,UIToolBar 更改为黑色

Swift:如何创建附加在导航栏下方的辅助栏?

ios - 我什么时候或者应该在 swift 中对一个类的对象使用弱引用?

swift - 从 Swift 2.x 到 Swift 4 的代码迁移

ios - 自定义 URL 方案错误 : This app is not allowed to query for scheme

xcode - swift 2,警告: could not load any Objective-C class information from the dyld shared cache

ios - SWRevealViewController 滑动手势导致应用程序崩溃

swift - 当 UITextField 已满或为空 Swift 时显示警报

swift - 快速从类创建数组

iphone - 如何在UITableView中将 "Dock"一个UIToolbar放到屏幕底部?