2011-03-25 49 views
1

在Xcode中是否有相當於Adjust to Fit for UILabel文本動態創建的文本? 即:文字調整以適應代碼?

UILabel *someLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 35, 18)];         
someLabel.font = [UIFont boldSystemFontOfSize:14]; 
someLabel.FOO_SIZETOFIT = YES; //FOO CODE 
[someLabel release]; 

回答

2

加入這一行

someLabel.adjustsFontSizeToFitWidth = YES; 
+0

謝謝!我搜索了AdjustFont,AdjustText ...但沒有用「s」。非常感激! – 2011-03-25 07:15:12

+0

歡迎,你可以接受幫助你的答案。 :) – 2011-03-25 07:18:46

+0

並使用文檔來找出這樣的事情,那麼就不會有任何錯過任何東西的機會。 :) – 2011-03-25 07:19:56