您的位置:首页 > 其它

SVPullToRefresh问题解决 同时进行上拉和下拉刷新

2015-10-27 17:37 381 查看
在使用SVPullToRefresh时发现当数据太少时,上拉和下拉刷新同时进行的时候,解决方法如下:

解决办法:

  打开iUIScrollView+SVInfiniteScrolling.m 找到第194行,

- (void)scrollViewDidScroll:(CGPoint)contentOffset {
if(self.state != SVInfiniteScrollingStateLoading && self.enabled) {
CGFloat scrollViewContentHeight = self.scrollView.contentSize.height;
CGFloat scrollOffsetThreshold = scrollViewContentHeight-self.scrollView.bounds.size.height;
if(!self.scrollView.isDragging && self.state == SVInfiniteScrollingStateTriggered)
{

if (self.scrollView.contentOffset.y>0) {   //把这个判断加上去即可。
self.state = SVInfiniteScrollingStateLoading;
}
} else if(contentOffset.y > scrollOffsetThreshold && self.state == SVInfiniteScrollingStateStopped && self.scrollView.isDragging)
self.state = SVInfiniteScrollingStateTriggered;
else if(contentOffset.y < scrollOffsetThreshold  && self.state != SVInfiniteScrollingStateStopped)
self.state = SVInfiniteScrollingStateStopped;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: