美文网首页
iOS-段落NSMutableParagraphStyle

iOS-段落NSMutableParagraphStyle

作者: fly大梦想家 | 来源:发表于2019-05-24 13:48 被阅读0次
       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

          本文链接:https://www.haomeiwen.com/subject/rwegzqtx.html