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 }

 

你可能感兴趣的:(ios)