1.常用属性和方法'
contentSize //设置滚动内容大小,一定要设置
pagingEnabled //是否按页滚动
bounces //弹簧效果
showsHorizontalScrollIndicator BOOL //显示水平滚动条
showsVerticalScrollIndicator BOOL //显示垂直滚动条
contentOffset CGPoint //设置位置内容
- (void)scrollRectToVisible:(CGRect)rect animated: (BOOL)animated //滚动到指定位置
2.代理方法
//scrollView滚动时,就调用该方法 执行多次
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
//开始滚动视图时调用 执行一次
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
//手指离开屏幕的瞬间调用,执行一次
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
//滑动减速时调用
- (void)scrollViewWillBeginDecelerating:(UIScrollView*)scrollView
//滑动停止时调用
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollVie
//滚动视图动画完成后调用,如果没有动画,该方法不被调用
- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
//返回将要缩放的uiview对象
-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
//当将要开始缩放时调用,一次有效缩放执行一次
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view
//当缩放结束后,并且缩放大小回到minimumZoomScale与maximumZoomScale之间后调用
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
3.UIPageControl
常用属性
numberOfPages 总页数
pageIndicatorTintColor 颜色
currentPage 当前页数
currentPageIndicatorTintColor 当前页颜色