desclabel.width = self.view.width - (leftOffset*2); desclabel.lineBreakMode = NSLineBreakByWordWrapping; desclabel.numberOfLines = 0; [desclabel sizeToFit];
1.规定高度
2.设置lineBreakMode
3.设置行数为0
4.执行sizeToFit
效果
desclabel.width = self.view.width - (leftOffset*2); desclabel.lineBreakMode = NSLineBreakByWordWrapping; desclabel.numberOfLines = 0; [desclabel sizeToFit];
1.规定高度
2.设置lineBreakMode
3.设置行数为0
4.执行sizeToFit
效果