UISrollView知识总结

 

UIScrollView 滚动视图

1.subviews,其中contentview负责显示内容,在滚动的过程中,通过监听gesture,来改变contentview的offset,显示不同的内容;vertical and horizontal scroll bar是另外的subview,又叫做scroll indicator

2.UITableView和UITextView都是UIScrollView的子类;

3.UIScrollView可以管理现实的内容,通过contentoffset控制显示的内容,

4.UIScrollView可以管理的滚动的操作,

5.UIScrollView可以管理scroll indicator,设置样式、是否显示

6.UIScrollView可以控制contentview的缩放zoom,

 

alwaysBounceVertical If this property is set to YES and bounces is YES, vertical dragging is allowed even if the content is smaller than the bounds of the scroll view. The default value is NO.

bounxces 设置为YES/NO,当拉到顶部底部时是否有弹跳的效果;

decelerationRate 调节拖拽后减速的快慢

pagingEnabled  设置scrollView整屏滚动

 

常见gesture:swipe滑动、drag托拉、click单击、long click长按、pinch挤压捏(pinch in缩进,pinch out扩大)、  

 

 

UIScrollViewDelegate委托方法:

Responding to Scrolling and Dragging

– scrollViewDidScroll:

– scrollViewWillBeginDragging:

通知delegate scrollView将要滚动contentView,这时手指按在屏幕上开始拖拽;

– scrollViewWillEndDragging:withVelocity:targetContentOffset:

– scrollViewDidEndDragging:willDecelerate:

通知delegate拖拽的动作结束,这时手指离开了屏幕;decelerate属性控制是立刻停止滚动还是逐渐减速;decelerate属性的值可以通过scrollView来设置;

– scrollViewShouldScrollToTop:

– scrollViewDidScrollToTop:

– scrollViewWillBeginDecelerating:

通知delegate滑动的速度开始减小

– scrollViewDidEndDecelerating:

Managing Zooming

– viewForZoomingInScrollView:

– scrollViewWillBeginZooming:withView:

– scrollViewDidEndZooming:withView:atScale:

– scrollViewDidZoom:

Responding to Scrolling Animations

– scrollViewDidEndScrollingAnimation:

通知delegate scrollView的滑动动画结束 

 

你可能感兴趣的:(view)