无法在Swift中的初始值设定项中设置UIButton buttonType
我想在Swift中对UIButton进行子类化。设置无法在Swift中的初始值设定项中设置UIButton buttonType,swift,Swift,我想在Swift中对UIButton进行子类化。设置buttonType class MyButton: UIButton { init(label: KeyLabelType) { super.init(frame: CGRectZero) self.buttonType = UIButtonType.Custom } } 关于这一点不正确的原因有什么建议吗?苹果的文档说buttonType是一个只读属性。你必须为此找到一个解决办法。可能
buttonType
class MyButton: UIButton {
init(label: KeyLabelType) {
super.init(frame: CGRectZero)
self.buttonType = UIButtonType.Custom
}
}
关于这一点不正确的原因有什么建议吗?苹果的文档说
buttonType
是一个只读属性。你必须为此找到一个解决办法。可能会给你你想要的