Centurion
Centurion

Reputation: 14314

How to design a custom view and attach it to UIButton view?

Is there any way how to create a xib with custom view (UIImage placeholder and UILabel placeholder), then to load the xib, grab its UIView and to pass it to UIButton view? The thing is I need to implement menu icon from design where button label is at the very bottom of the menu icon. By default the label in UIButton appears in the center. Heard it's possible to design a custom view in xib, load and use.

Upvotes: 0

Views: 446

Answers (1)

Mundi
Mundi

Reputation: 80271

Assuming the nib is wired up with an IBOutlet named subView,

subView = [[NSBundle mainBundle] loadNibNamed:@"mySubview" 
                                           owner:self options:nil];

Now you can use the subview to construct your button.

Upvotes: 1

Related Questions