让tableView不能下拉但是可以上拉

设置tableView的bounces属性,默认为YES,可上下出现弹性区,需要写在scrolView的代理方法中:


-(void)scrollViewDidScroll:(UIScrollView *)scrollView

{

    if (scrollView.contentOffset.y<=NavBarHeight) {

        _tableView.bounces = NO;

    }else{

        _tableView.bounces = YES;

    }

}

你可能感兴趣的:(iOS)