textfield首行缩进

#pragma mark - UITextView delegate Methods
-(void)textViewDidChange:(UITextView *)textView{
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
          paragraphStyle.lineSpacing = 30;    //行间距
          paragraphStyle.maximumLineHeight = 60;   /**最大行高*/
          paragraphStyle.firstLineHeadIndent = 20.f;    /**首行缩进宽度*/
          paragraphStyle.alignment = NSTextAlignmentJustified;
    NSDictionary *attributes = @{
                                 NSFontAttributeName:[UIFont systemFontOfSize:15],
                                 NSParagraphStyleAttributeName:paragraphStyle
                                 };
    textView.attributedText = [[NSAttributedString alloc] initWithString:textView.text attributes:attributes];
}

转载于:https://www.cnblogs.com/YH-Coding/p/5754290.html

你可能感兴趣的:(textfield首行缩进)