NSParagraphStyle中的paragraphSpacingBefore导致插入符号位于UITextView

时间:2017-11-20 06:00:35

标签: swift uitextview

当我在paragraphSpacingBefore中分配NSMutableParagraphStyle属性时,UITextView的插入符号在输入时位于文本上方。我该如何解决这个问题?

func something() -> NSMutableParagraphStyle {

    let paraStyle = NSMutableParagraphStyle()
    paraStyle.paragraphSpacing = quoteParagraphSpacing
    paraStyle.lineSpacing = 10

    paraStyle.paragraphSpacingBefore = 20
    paraStyle.alignment = .left
    return paraStyle

}

此功能就像这样使用。

textView.typingAttributes = [NSAttributedStringKey.paragraphStyle.rawValue: something(), ....]

截图

As I type, the text appears at the bottom area while the caret is on top

0 个答案:

没有答案