如果从故事板创建按钮,则更改子类中的 UIButton 类型
Change UIButton type in subclass if button created from storyboard
如果我在 Storyboard 中创建一个 UIButton
并将其 Class 指定为我创建的子类 (HighlightTappedButton
),子类中有没有办法更改 buttonType
到 Custom
?
我知道我可以在情节提要中将类型更改为 Custom
,但我不想每次都记得这样做。
我认为在运行时是不可能的。因为它是一个只读方法。我想您会从这些链接中得到有用的问题。
set UIButton's buttonType programmatically
Change UIButton type programatically
how to set UIButton type in UIButton Subclass
如果我在 Storyboard 中创建一个 UIButton
并将其 Class 指定为我创建的子类 (HighlightTappedButton
),子类中有没有办法更改 buttonType
到 Custom
?
我知道我可以在情节提要中将类型更改为 Custom
,但我不想每次都记得这样做。
我认为在运行时是不可能的。因为它是一个只读方法。我想您会从这些链接中得到有用的问题。
set UIButton's buttonType programmatically
Change UIButton type programatically
how to set UIButton type in UIButton Subclass