开发者

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开发者_StackOverflow中文版 when the size of the label raise, it wrap the button. How can I rearrange the view ? Thanks in advance


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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜