码迷,mamicode.com
首页 > 其他好文 > 详细

scrollview滚动到指定区域的两种方法

时间:2015-07-08 02:04:44      阅读:500      评论:0      收藏:0      [点我收藏+]

标签:

方法一:利用偏移量来滚动

- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;

方法二:利用rect来滚动

- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated; 

注意点:如何使用scrollRectToVisible:animated:这个方法,需要把contentSize的width和height都不能为0,否则不能滚动。

scrollview滚动到指定区域的两种方法

标签:

原文地址:http://www.cnblogs.com/samyangldora/p/4629000.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!