UIScrollView:单击将其滚动到顶部

UIScrollView: single tap scrolls it to top(UIScrollView:单击将其滚动到顶部)

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

问题描述

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

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:单击将其滚动到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:UIScrollView:单击将其滚动到顶部

基础教程推荐