NSMutableParagraphStyle /NSParagraphStyle
生活随笔
收集整理的這篇文章主要介紹了
NSMutableParagraphStyle /NSParagraphStyle
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
// NSParagraphStyleAttributeName 段落的風格(設置首行,行間距,對齊方式什么的)看自己需要什么屬性,寫什么 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.lineSpacing = 10;// 字體的行間距 paragraphStyle.firstLineHeadIndent = 20.0f;//首行縮進 paragraphStyle.alignment = NSTextAlignmentJustified;//(兩端對齊的)文本對齊方式:(左,中,右,兩端對齊,自然) paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;//結尾部分的內容以……方式省略 ( "...wxyz" ,"abcd..." ,"ab...yz") paragraphStyle.headIndent = 20;//整體縮進(首行除外) paragraphStyle.tailIndent = 20;// paragraphStyle.minimumLineHeight = 10;//最低行高 paragraphStyle.maximumLineHeight = 20;//最大行高 paragraphStyle.paragraphSpacing = 15;//段與段之間的間距 paragraphStyle.paragraphSpacingBefore = 22.0f;// 段首行空白空間 /* Distance between the bottom of the previous paragraph (or the end of its paragraphSpacing, if any) and the top of this paragraph. */ paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;//從左到右的書寫方向(一共??三種) paragraphStyle.lineHeightMultiple = 15;/* Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height. */ paragraphStyle.hyphenationFactor = 1;//連字屬性 在iOS,唯一支持的值分別為0和1 /* NSFontAttributeName 字體大小 NSParagraphStyleAttributeName 段落的風格(設置首行,行間距,對齊方式什么的) NSKernAttributeName 字間距 */ NSDictionary *attributes = @{ NSFontAttributeName:[UIFont systemFontOfSize:15], NSParagraphStyleAttributeName:paragraphStyle, NSKernAttributeName:@(10), }; textView.attributedText = [[NSAttributedString alloc] initWithString:textView.text attributes:attributes];
?
轉載于:https://www.cnblogs.com/heng-hengHenry/p/5653780.html
總結
以上是生活随笔為你收集整理的NSMutableParagraphStyle /NSParagraphStyle的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 细节总结
- 下一篇: mysql 主从配置(master sl