nyanev
nyanev

Reputation: 11519

UILabel Dynamic height problem

I have one UILabel and one button under the label. Height of the label is dynamic. I use this: [label sizeToFit]; But when the size of the label raise, it wrap the button. How can I rearrange the view ? Thanks in advance

Upvotes: 1

Views: 723

Answers (1)

Steve
Steve

Reputation: 31642

How about something like this:

[label sizeToFit];
btn.frame = label.frame;

Thereby setting your button to the same size as the label... or manually adding some padding like this:

[label sizeToFit];
btn.frame = CGRectMake(label.frame.origin.x - 10, label.frame.origin.y - 10, label.frame.size.width + 20, label.frame.size.height + 20);

Upvotes: 1

Related Questions