设置UIScrollView的 滚动范围
@property(nonatomic) CGPoint contentSize
注: scrollView.frame 和scrollView.contentSize 区别
scrollView.frame 表示的是可视范围 (能看到的范围)
self.scrollView.contentSize = CGSizeMake(400 , 350 );
// 让滚动范围是图片的大小
self.scrollView.contentSize = self.imageView.frame.size ;
self.scrollView.contentSize = self.imageView.image.size ;
设置UIScrollView的滚动位置
@property(nonatomic) CGSize contentOffset
在UIScrollView的四周增加额外的滚动区域
@property(nonatomic) UIEdgeInsets contentInset
self.scrollView.contentInset = UIEdgeInsetsMake ( CGFloat top , xx left , xx bottom , xx right ) ;
下图老师上课图 :
如果UIScrollView不可以滚动:
>.有没有设置contentSize
>.scrollViewEnabled =NO;
>.没有接收到触摸事件 userInteractionEnabled =NO;
>.没有取消autolayout功能 (要想scrollView滚动,必须取消autolayout)
>..... .... 等等