UIScrollView:单击可将其滚动到顶部 [英] UIScrollView: single tap scrolls it to top

查看:114
本文介绍了UIScrollView:单击可将其滚动到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将UIScrollView的pagingEnabled设置为YES,并以编程方式将其内容滚动到底部:

I have the UIScrollView with pagingEnabled set to YES, and programmatically scroll its content to bottom:

CGPoint contentOffset = scrollView.contentOffset;
contentOffset.y = scrollView.contentSize.height - scrollView.frame.size.height;
[scrollView setContentOffset:contentOffset animated:YES];

它成功滚动,但在此之后,单击它的内容向上滚动以抵消它刚才在它向下滚动之前。只有当我将scrollView的内容滚动到底部然后点击时,才会发生这种情况。当我滚动到任何其他偏移然后点击时,没有发生任何事情。

it scrolls successfully, but after that, on single tap its content scrolls up to offset that it has just before it scrolls down. That happens only when I programmaticaly scroll scrollView's content to bottom and then tap. When I scroll to any other offset and then tap, nothing is happened.

这绝对不是我想要的。应如何修复?

That's definitely not what I'd like to get. How that should be fixed?

提前多多谢谢!

帖木儿。

推荐答案

这似乎是一个错误:

UIScrollView不记得位置

我在iOS上测试了这个4.2(模拟器),问题仍然存在。

I have tested this on iOS 4.2 (Simulator) and the issue remains.

这篇关于UIScrollView:单击可将其滚动到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆