I want to use uibutton which has custom text like screen shot shows. In screen shot I added 2 uilabel to text "Module 1" and "Fungi & Fungal Infections" but and orange background is uibutton but when I press down is it shows that It only press orange button and not text. What I want that I'll set these to label to uibutton text so that It'll show that when button press down then text should have same effect like button's title. How this possible kindly guide me on this, this will be great for me. Thanks in advance.
0
votes
2 Answers
2
votes
Is easy, just create label with attributed text that you want and add it to uiButton as subview, like this. Button set to custom type in storyboard.
UILabel * label = [UILabel new];
label.backgroundColor = [UIColor redColor];
label.text = @"Custom text";
[label sizeToFit];
label.frame = _button.bounds;
[_button addSubview:label];