自定义 UIButton Swift 2.0

Custom UIButton Swift 2.0

我正在尝试将我的项目转换为 Swift 2.0。我有一个自定义 UIButton,现在在我尝试构建时导致错误。 我的代码是:var myButton = MyCustomButton.buttonWihType(.Custom) as UIButton

这适用于我在 Swift 1.2 中的项目,但现在不起作用。该按钮使用一个名为 MyCustomButton

的 UIButton 文件来绘制它

谢谢

你试过了吗?

var myButton = MyCustomButton(type: .Custom)