我对 UILabel 有疑问。我想多行显示评论。但它们是单行的。这是我的代码:
CGRect currentFrame = comment.frame;
CGSize max = CGSizeMake(comment.frame.size.width,20000.0f);
CGSize expected = [comment.text sizeWithFont:[UIFont systemFontOfSize:10.0] constrainedToSize:max lineBreakMode:UILineBreakModeWordWrap];
currentFrame.size.height = expected.height;
comment.frame = currentFrame;
comment.numberOfLines = 0;
[comment sizeToFit];
但结果并不好。我哪里错了?