开发者

Text Adjust to Fit in code?

开发者 https://www.devze.com 2023-02-19 10:47 出处:网络
Is there an equivalent of Adjust to Fit for UILabel text created dynamically in Xcode? ie: UILabel *someLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 35, 18)];开发者_开发知识库

Is there an equivalent of Adjust to Fit for UILabel text created dynamically in Xcode? ie:

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


add this line

someLabel.adjustsFontSizeToFitWidth = YES;
0

精彩评论

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