获取UIScrollView滚动到顶部 [英] Get UIScrollView to scroll to the top
本文介绍了获取UIScrollView滚动到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将UIScrollView滚动到顶部?
How do I make a UIScrollView scroll to the top?
推荐答案
iOS 7更新
UPDATE FOR iOS 7
[self.scrollView setContentOffset:
CGPointMake(0, -self.scrollView.contentInset.top) animated:YES];
ORIGINAL
ORIGINAL
[self.scrollView setContentOffset:CGPointZero animated:YES];
或者如果你想保留水平滚动位置而只是重置垂直位置:
or if you want to preserve the horizontal scroll position and just reset the vertical position:
[self.scrollView setContentOffset:CGPointMake(self.scrollView.contentOffset.x, 0)
animated:YES];
这篇关于获取UIScrollView滚动到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文