【问题标题】:buttonWithType' is unavailable: use object construction 'UIButton(type:)buttonWithType' 不可用:使用对象构造 'UIButton(type:)
【发布时间】:2017-05-25 08:16:21
【问题描述】:

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

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

但得到错误

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

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

【问题讨论】:

    标签: ios swift swift3 uibutton


    【解决方案1】:

    对于 Swift 3,语法如下:

    let button = UIButton(type: .detailDisclosure)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 2014-05-24
      相关资源
      最近更新 更多