Reputation: 34523
Is it not possible to add a subview to a UIButton via Storyboard? This answer suggests it is possible in code, but how do you do it via Storyboard? Dragging a UIView to become a child of a UIButton isn't working.
Aware of simple workarounds like creating a parent UIView to hold the UIButton and subviews, but this question focuses on whether it's possible to add subviews to a UIButton inside of Storyboard.
Upvotes: 2
Views: 3739
Reputation: 4538
You cannot add subviews to UIButton
in Interface Builder, use UIView
as container, then add UIButton
and whatever you want to it. Note, eg. you can place a UILabel
on top of the button and if you do not set userInteractionEnabled = YES
for that label, your button will still response to touch events. Also refer to this answer.
Upvotes: 5