Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I addSubview to UIButton in Interface Builder

Like I said, I add a UIButton in Interface Builder, I want add a UILabel、UIImageView as the button's subviews, but I can't add any object on it in IB. IS anybody know how to do this? Thank you very much.

I can use code to achieve that, but I want achieve it in IB, so I can use it in any class I want.

like image 351
tinln Avatar asked Nov 14 '12 07:11

tinln


1 Answers

I have done this before by adding a UIView (instead of the UIButton) then add the UIButton and UILabel to the UIView. The tap from the UIButton still works and you have a label too. You can also add anything else like this.

like image 192
Fogmeister Avatar answered Sep 20 '22 06:09

Fogmeister