Adam Johns
Adam Johns

Reputation: 36353

Change UIButton type in subclass if button created from storyboard

If I create a UIButton in Storyboard and assign its Class to be a subclass I made (HighlightTappedButton), is there a way in the subclass to change the buttonType to Custom?

I know I can just change the type to Custom in storyboard, but I don't want to have to remember to do that every time.

Upvotes: 5

Views: 3786

Answers (1)

Sudhin Davis
Sudhin Davis

Reputation: 2020

I think it is not possible at runtime. Since it is a read-only method. I think you will get helpful questions from these links.

set UIButton's buttonType programmatically

Change UIButton type programatically

how to set UIButton type in UIButton Subclass

Upvotes: 3

Related Questions