UILabel * yourLabel = [[UILabel alloc] initWithFrame....];
yourLabel.adjustsFontSizeToFitWidth = NO;
yourLabel.lineBreakMode = UILineBreakModeTailTruncation;
yourLabel.text = @"Some long text that not fit frame, many words, many symbols";
在屏幕上,我看到"一些不长的文字......" 如何获取字符串"一些不是" 或尾"的长文本适合框架,多个单词,多个符号" ?
答案 0 :(得分:0)
试试这段代码
yourLabel.adjustsFontSizeToFitWidth = NO;
yourLabel.lineBreakMode = UILineBreakModeWordWrap;
yourLabel.numberOfLines = 0;
答案 1 :(得分:0)
请一行添加您的代码并进行检查
[yourLabel sizeToFit];