当UIScrollView到达其内容视图的结尾时,我具有以下代码来捕获事件:
- (void) scrollViewDidEndDecelerating:(UIScrollView *) scrollView
{
float currentEndPoint = scrollView.contentOffset.y + scrollView.frame.size.height;
// CGPoint bottomOffset = CGPointMake(0, scrollView.contentSize.height - scrollView.bounds.size.height);
// [scrollView setContentOffset:bottomOffset animated:NO];
if (currentEndPoint >= scrollView.contentSize.height)
{
// We are at the bottom
我注意到,当我滚动到底部时,它将击中并弹起。
如果我添加此:
CGPoint bottomOffset = CGPointMake(0, scrollView.contentSize.height - scrollView.bounds.size.height);
[scrollView setContentOffset:bottomOffset animated:NO];
然后滚动回到底部。
有什么办法可以让它停留在底部而不会“反弹”,因为一旦它撞到底部,就阻止它移动。
谢谢。
您应该取消选中scrollview的bounce属性。检查屏幕截图!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句