问题描述
我知道这个命令:
self.tableView.scrollEnabled = true
问题是:我想根据scrollView位置锁定滚动。为此,我这样做:
The question is: I want to lock scrolling according to the scrollView position. For this I do:
let topEdge = scrollView.contentOffset.y
let followersViewEdge = CGRectGetHeight(self.profileView.frame) - 50
if topEdge >= followersViewEdge {
self.tableView.scrollEnabled = true
}
它有效,但问题是它没有立即锁定或解锁滚动。要锁定或解锁UITableView滚动,我需要从屏幕上松开手指并再次滚动。在这种情况下它有效。
it works, but the problem is that it does not lock or unlock the scrolling immediately. For locking or unlocking the UITableView scrolling I need to release my finger from the screen and scroll again. In this case it works.
我想立即制作它,所以当我在屏幕上滑动时它锁定并解锁滚动。我该怎么办?
I want to make it immediately, so it locks and unlocks the scrolling while I'm swiping on the screen. How can I do it?
更新
我的代码有效。这不是一个问题。问题是我需要立即进行这些更改,而不是将手指从屏幕上移开。
My code works. It's not a problem. Problem is that I need to make these changes immediately, without releasing my finger from the screen.
所以,不要回答我如何锁定滚动!我知道怎么做。
So, do not answer me how to lock scrolling! I know how to do this.
推荐答案
- 选择tableview
- 选择属性消隐程序
- 在滚动视图部分中,取消选中已启用滚动属性
这篇关于如何在UITableView中启用/禁用滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!