首页 > 解决方案 > 强制 UITextView 按需呈现文本?

问题描述

我将 aUITextView用作UIButton单击 a 时开始的某些操作的日志。但是, when changedtext属性UITextView不会在更新时呈现。整个日志文本列表仅作为IBAction返回UIButton值显示。

这实际上是可能的还是我应该查看其他一些 UI 对象?

编辑添加下面的示例代码:

var log: UITextView!
IBAction func runOps() {
 self.log += "Starting ops..."

 self.log += "Starting ops1.."
 self.ops1()
 self.log += "ops1 completed.."

 self.log += "Starting ops2.."
 self.ops2()
 self.log += "ops2 completed.."
}

标签: iosswift

解决方案


我认为您可以尝试使用 NotificationCenter。

在此处输入图像描述


推荐阅读