1. 禁止上下滚动
contentsize.height =0即可
2.禁止左右滚动
contentsize.width = 0即可
3.禁止滚动
contentsize.height =0; contentsize.width = 0;
但是用 scrollEnabled = NO; 更方便
4.禁止下滚动
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.y <= 0.0) {
CGFloat sizeWidth = scrollView.contentSize.width;
CGFloat sizeHeght = scrollView.contentSize.height;
[scrollView setContentSize:CGSizeMake(sizeWidth, 0)];
[scrollView setContentSize:CGSizeMake(sizeWidth, sizeHeght)];
}
}
4.禁止上滚动
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.y >= 0.0) {
CGFloat sizeWidth = scrollView.contentSize.width;
CGFloat sizeHeght = scrollView.contentSize.height;
[scrollView setContentSize:CGSizeMake(sizeWidth, 0)];
[scrollView setContentSize:CGSizeMake(sizeWidth, sizeHeght)];
}
}
其他的同理