标签:style os io ar for cti sp on c
默认CGPointZero,用来设置scrollView的滚动偏移量。
// 设置scrollView的滚动偏移量
scrollView.contentOffset = CGPointMake(0, 200);
默认CGSizeZero,用来设置scrollView的滚动范围。
// 设置scrollView的滚动范围
scrollView.contentSize = CGSizeMake( self.view.bounds.size.width, self.view.bounds.size.height * 2);
默认 UIEdgeInsetsZero,用来设置scrollView的额外滚动区域。
// 设置scrollView的额外顶部滚动区域:(UIEdgeInsetsMake是逆时针设置,上左下右)
scrollView.contentInset = UIEdgeInsetsMake(100, 0, 0, 0);
4. bounces
默认为YES,用来设置scrollView的弹簧效果
// 取消scrollView的弹簧效果
scrollView.bounces = NO;
默认为NO,用来设置scrollView是否开启分页.
// 开启分页
scrollView.pagingEnabled = YES;
默认为YES,用来设置scrollView是否允许滚动.
// scrollView禁止滚动
scrollView.scrollEnabled = NO;
默认为YES,用来设置scrollView是否显示水平滚动条.
// 隐藏水平滚动条
scrollView.showsHorizontalScrollIndicator = NO;
默认为YES,用来设置scrollView是否显示垂直滚动条.
// 隐藏垂直滚动条
scrollView.showsVerticalScrollIndicator = NO;
默认1.0,用来设置scrollView最少缩小比例.
// 设置scrollView允许子视图的最大放大比例
scrollView.maximumZoomScale = 2;
默认1.0,用来设置scrollView最大放大比例.
// 设置scrollView允许子视图的最小缩放比例
scrollView.minimumZoomScale = 0.8;
类要遵守UIScrollViewDelegate协议
scrollView.delegate = self; 声明scrollView的代理是我, 这个方法在UIScrollViewDelegate里所以我们要遵守UIScrollViewDelegate这个协议
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
- (void)scrollViewDidZoom:(UIScrollView *)scrollView NS_AVAILABLE_IOS(3_2);
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset NS_AVAILABLE_IOS(5_0);
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;
- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;
// 列如:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return scrollView.subviews[0];
}
- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view NS_AVAILABLE_IOS(3_2);
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale;
scrollViewWillBeginDragging –> scrollViewDidScroll -> scrollViewWillEndDragging -> scrollViewDidEndDragging
scrollViewWillBeginDragging -> scrollViewDidScroll -> scrollViewDidEndDragging ->scrollViewWillBeginDecelerating ->scrollViewDidScroll -> scrollViewDidEndDecelerating
指定控件是否只能在一个方向上滚动
改变scrollerView的减速点位置
监控当前目标是否正在被跟踪
改变scrollerView的减速点位置
控制视图是否延时调用开始滚动的方法
控制控件是否接触取消touch的事件
设定滚动条的样式
监控当前目标是否正在减速
标签:style os io ar for cti sp on c
原文地址:http://www.cnblogs.com/tsangyupsing/p/3954709.html