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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Restoring Scroll Position in Paging Library 3(恢复分页库3中的卷轴位置)
Android Paging 3 - get list of data from PagingDatalt;Tgt; object(Android分页3-从PagingDatalt;Tgt;对象获取数据列表)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)