答案 0 :(得分:1)
ADD THIS TO YOUR CODE:
CGSize maximumLabelSize = CGSizeMake(296, FLT_MAX);
CGSize expectedLabelSize = [yourString sizeWithFont:yourLabel.font constrainedToSize:maximumLabelSize lineBreakMode:yourLabel.lineBreakMode];
CGRect newFrame = yourLabel.frame;
newFrame.size.height = expectedLabelSize.height;
yourLabel.frame = newFrame;
答案 1 :(得分:-1)
添加此代码
[yourlabel sizeToFit]; 要么 [yourView sizeToFit];