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

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

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

方法二:利用rect来滚动

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

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

posted @ 2015-07-08 01:32  samyang1107  阅读(7524)  评论(0编辑  收藏  举报