UIScrollView

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;

  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值