【发布时间】:2015-04-29 13:15:01
【问题描述】:
我用scrollEnabled = true 初始化了 UITextView。
但是一旦我设置了scrollEnabled = false,即使我设置了scrollEnabled = true,文本视图也不会滚动
还有其他方法可以切换 textView 的滚动吗?
我将userInteractionEnabled 设置为true。
在
override func viewDidLoad() {
view.addSubview(scrollView)
scrollView.delegate = self
scrollView.addSubview(textView)
}
在
func scrollViewDidScroll(scrollView: UIScrollView) {
if scrollView.contentOffset.y >= 180 {
textView.scrollEnabled = true // This does not work!
} else {
textView.scrollEnabled = false // This works!
}
}
【问题讨论】:
-
将您创建/启用/禁用的代码发布到滚动和文本视图。
标签: ios scroll uitextview