1.Strangely enough you can not set the contentSize property of the UIScrollView from Interface Builder. You will have to do it from the view controller managing this scroll view.
选中界面中的一些控件,点击菜单 Layout/Embed Objects In/Scroll View,会自动为这些控件生成一个父ScrollView.
重要属性:
contentSize:
contentInset:是scrollview的contentview的顶点相对于scrollview的frame的左顶点的位置,
contentInset.top 导航控件栏的高度,contentInset.bottom工具栏的高度。 ??
contentOffset:是scrollview当前显示区域顶点相对于frame顶点的偏移量
scrollIndicatorInsets.top
如果属性pageEnabled = YES,则设置其为分页模式,那么每滚动一次就是一页,垂直方向上的一页就是UIScrollView的高度,水平方向就是UIScrollView的宽度。
2.UIScrollViewDelegate代理的viewForZoomingInScrollView方法返回一个缩放的subView
3.翻页的大小是bounds的大小,例如:一页中的图像满屏,但左右两边还有间距的效果,是设置了scrollview.frame的宽度大于屏幕宽度。
4.scrollsToTop属性
默认为YES,它控制是否在点击手机的状态栏时,使scrollView滚动到顶部。
UIWebView的scrollView的scrollsToTop属性默认为NO。
这个手势只能工作在只有一个scrollsToTop为YES的scroll view时,如果有多个或scrollViewShouldScrollToTop返回NO,这个手势就失效了。
在滚动到顶部后,scrollViewDidScrollToTop被调用。
This gesture works on a single visible scroll view; if there are multiple scroll views (for example, a date picker) with this property set, or if the delegate returns NO in scrollViewShouldScrollToTop:, UIScrollView ignores the request. After the scroll view scrolls to the top of the content view, it sends the delegate a scrollViewDidScrollToTop:
5.在顶部和底部时,禁用拖动回弹:
scrollView.bounces = NO;