美文网首页
NSMutableParagraphStyle

NSMutableParagraphStyle

作者: 半江瑟瑟 | 来源:发表于2018-12-12 13:16 被阅读1次

https://developer.apple.com/documentation/uikit/nsmutableparagraphstyle/1527729-paragraphspacingbefore?language=objc

image.png image.png
image.png
image.png
image.png

NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];

paragraphStyle.lineSpacing = 20.;// 行间距
paragraphStyle.lineHeightMultiple = 1.5;// 行高倍数(1.5倍行高)
paragraphStyle.firstLineHeadIndent = 30.0f;//首行缩进
paragraphStyle.minimumLineHeight = 10;//最低行高
paragraphStyle.maximumLineHeight = 20;//最大行高(会影响字体)

paragraphStyle.alignment = NSTextAlignmentLeft;// 对齐方式
paragraphStyle.defaultTabInterval = 144;// 默认Tab 宽度
paragraphStyle.headIndent = 20;// 起始 x位置
paragraphStyle.tailIndent = 320;// 结束 x位置(不是右边间距,与inset 不一样)

paragraphStyle.paragraphSpacing = 44.;// 段落间距
paragraphStyle.paragraphSpacingBefore = 44.;// 段落头部空白


paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;// 分割模式
/*
 NSLineBreakByWordWrapping = 0,      // Wrap at word boundaries, default
 NSLineBreakByCharWrapping,  // Wrap at character boundaries
 NSLineBreakByClipping,  // Simply clip
 NSLineBreakByTruncatingHead, // Truncate at head of line: "...wxyz"
 NSLineBreakByTruncatingTail, // Truncate at tail of line: "abcd..."
 NSLineBreakByTruncatingMiddle // Truncate middle of line:  "ab...yz"
 */


paragraphStyle.baseWritingDirection = NSWritingDirectionRightToLeft;// 段落方向
/*
 NSWritingDirectionNatural       = -1,    // Determines direction using the Unicode Bidi Algorithm rules P2 and P3
 NSWritingDirectionLeftToRight   =  0,    // Left to right writing direction
 NSWritingDirectionRightToLeft   =  1
 */

引用:
https://www.jianshu.com/p/4bb42470cfdd

相关文章

网友评论

      本文标题:NSMutableParagraphStyle

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