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];
}

posted @ 2016-08-09 18:40  YH_Coding  阅读(588)  评论(0编辑  收藏  举报