iOS 文本首行缩进

 1 NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
 2     paragraphStyle.lineHeightMultiple = 20.f;
 3     paragraphStyle.maximumLineHeight = 25.f;
 4     paragraphStyle.minimumLineHeight = 15.f;
 5     paragraphStyle.firstLineHeadIndent = 20.f; // 首行缩进
 6     paragraphStyle.alignment = NSTextAlignmentJustified;
 7     NSMutableDictionary *attributes = [@{ NSFontAttributeName:[UIFont systemFontOfSize:15], NSParagraphStyleAttributeName:paragraphStyle, NSForegroundColorAttributeName:[UIColor colorWithRed:153/255. green:102/255. blue:51/255. alpha:1]
 8                                           }mutableCopy];
 9     self.textView.attributedText = [[NSAttributedString alloc]initWithString:@"ssssssssssssssssssssssss" attributes:attributes];
10 }

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。