📜  uitextview 文本对齐 - Swift 代码示例

📅  最后修改于: 2022-03-11 15:00:58.629000             🧑  作者: Mango

代码示例1
Swift 5:
let textView = UITextView(frame: CGRect(x: 0, y: 0, width: 300, height: 300))
let style = NSMutableParagraphStyle()
style.alignment = .center
let text = NSAttributedString(string: yourtextcontentstring,
                              attributes: [NSParagraphStyleAttributeName:style])
textView.attributedText = text