ビューに UILabel があり、コンテンツに基づいてサイズを変更する必要がありますが、そうではありません。その中に複数行のコンテンツがあります。[label sizeToFit]
+ を試しlabel.numberOfLines= 0
ました。
UILabel の制約はありません。
代わりに UITextView も使用しようとしましたが、フォントは 13 のままで、17 では望んでいません。
これは現在動作するコードです:
UILabel *textLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(20, 158, self.view.bounds.size.width-40, 550)];
textLabel2.text = textString;
textLabel2.font = [UIFont fontWithName:@"Helvetica Neue" size:17];
textLabel2.numberOfLines = 0;
[textLabel2 sizeToFit];
[self.scroller addSubview:textLabel2];