当我在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(), ....]
截图