我正在尝试连接两个 UItextView
它起作用了。
它们具有不同的属性(例如不同的 UIFont
),但在最终的 UITextView
中它们具有相同的属性。如何解决这个问题?
textViewFirst!.text = "\n Example"
textViewFirst!.font = UIFont(name: "Helvetica Neue", size: 10);
textViewSecond.text = textViewSecond.text + textViewFirst.text
最佳答案
例如:这会使文本从第 4 个字符到第 7 个字符变为粗体
let myFullString:String = textViewSecond.text + textViewFirst.text as String
var attributedText: NSMutableAttributedString = NSMutableAttributedString(string: myFullString)
attributedText.addAttributes([NSFontAttributeName: UIFont.boldSystemFontOfSize(14)], range: NSRange(location: 3, length: 3))
textViewSecond.attributedText = attributedText
关于ios - 如何连接两个UITextView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30668937/