buttonWithType' 不可用:使用对象构造 'UIButton(type:)



我有一个旧版本的 Swift 并尝试这样做:

let button = UIButton.buttonWithType(UIButtonType.detailDisclosure) as UIButton

但是得到错误

buttonWithType' 不可用:使用对象构造 'UIButton(type:(

我该如何解决这个问题?我正在使用 Swift 3。

对于 Swift 3,语法如下:

let button = UIButton(type: .detailDisclosure)

相关内容

最新更新