禁止scrollVie滚动

来源:互联网 发布:非凡网络加速器下载 编辑:程序博客网 时间:2024/06/04 00:20

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)];


    }

}


其他的同理





0 0
原创粉丝点击