iOS 13 UIToolBar Style



我正试图为我在swift中使用的数字键盘创建一个工具栏,但收到了以下代码的警告:

'blackTranslucent' was deprecated in iOS 13.0: Use UIBarStyleBlack and set the translucent property to YES instead

我没有看到任何类型为UIBarStyleBlack的属性带有UIToolBar,如何消除此警告?

let doneToolbar: UIToolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: 320, height: 50))
doneToolbar.barStyle = .blackTranslucent

您可以使用doneToolbar.isTranslucent = true

最新更新