0
点赞
收藏
分享

微信扫一扫

iOS开发 - 让tableView不能下拉刷新,可以上拉加载


刚刚被问到如题的问题,索性试了下,主要是设置tableView的bounces属性,默认为YES,可上下出现弹性区,需要写在scrolView的代理方法中:

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
NSLog(@"%f",_tableView.contentOffset.y);
if (_tableView.contentOffset.y <= 100) {
_tableView.bounces = NO;
}
else
{
_tableView.bounces = YES;
}
}

tableView也是支持scrollView的代理方法的,所以UIScrollViewDelegate是可以不写的。


举报

相关推荐

0 条评论