iOS-段落NSMutableParagraphStyle

   NSMutableAttributedString * attributedString = [[NSMutableAttributedString alloc]initWithString:_content];
    [attributedString addAttribute:NSForegroundColorAttributeName value:[GOVCommon colorForKey:@"noticeViewMainColor"] range:NSMakeRange(0, _content.length)];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
    paragraphStyle.maximumLineHeight = LAYOUT_SIZESCALE_PORTRAIT(12, 6).height;  // 最大行间距
    paragraphStyle.minimumLineHeight = LAYOUT_SIZESCALE_PORTRAIT(12, 6).height;  // 最小行间距
    paragraphStyle.paragraphSpacingBefore = LAYOUT_SIZESCALE_PORTRAIT(12, 14).height; // 段间距
    paragraphStyle.firstLineHeadIndent = LAYOUT_SIZESCALE_PORTRAIT(40, 40).width;  // 段落第一行缩进
    paragraphStyle.lineSpacing = 20; // 行间距
    paragraphStyle.headIndent = 50; // 头缩进
    paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [_content length])];

你可能感兴趣的:(iOS-段落NSMutableParagraphStyle)