UILabel align to top
UILabel will always align to the middle of the size of the control. So if you want to align to the top of margin, you have to set the height of the control exact the same to the height that need to show the text:
UILabel *l2; // l2 is the label that we are working
// find the new height
CGRect l2Rect = [l2 textRectForBounds:l2.bounds limitedToNumberOfLines:999];
// reset the height
CGRect f = l2.frame;
f.size.height = l2Rect.size.height;
l2.frame = f;
由 water 在 週四, 2009-10-22 17:37 發表

最新回應
18 周 4 天前
23 周 6 天前
27 周 2 天前
28 周 2 天前
37 周 17 小時前
37 周 17 小時前
37 周 1 天前
37 周 3 天前
39 周 1 天前
39 周 2 天前