1      cell.teacherDescriptionLabel.text = content;
 2             cell.teacherDescriptionLabel.textAlignment = NSTextAlignmentJustified;
 3             NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:content];
 4             NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
 5             paragraphStyle.alignment = NSTextAlignmentJustified;//设置对齐方式
 6             paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
 7             [paragraphStyle setLineSpacing:7];//调整行间距
 8             
 9             [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [content length])];
10             cell.teacherDescriptionLabel.attributedText = attributedString;

我们假定cell中的一个UILabel需要把间距设置大一点 ,只需要把普通的文本转成带有格式的文本就行了 


 
                    
            
                

相关文章:

  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2021-10-15
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-13
  • 2021-05-11
相关资源
相似解决方案