首页 > 代码库 > MJ刷新控件MJRefreshFooterView上拉之后收不回来的解决办法

MJ刷新控件MJRefreshFooterView上拉之后收不回来的解决办法

修改MJRefreshFooterView.m文件中的这个方法

#pragma
mark - 状态相关#pragma mark 设置状态- (void)setState:(MJRefreshState)state{ if (_state == state) return; MJRefreshState oldState = _state; [super setState:state]; switch (state){ case MJRefreshStatePulling:{ _statusLabel.text = MJRefreshFooterReleaseToRefresh; [UIView animateWithDuration:MJRefreshAnimationDuration animations:^{ _arrowImage.transform = CGAffineTransformIdentity; UIEdgeInsets inset = _scrollView.contentInset; inset.bottom = _scrollViewInitInset.bottom; _scrollView.contentInset = inset; }]; break; } case MJRefreshStateNormal:{ _statusLabel.text = MJRefreshFooterPullToRefresh; // 刚刷新完毕 CGFloat animDuration = MJRefreshAnimationDuration; CGFloat deltaH = [self contentBreakView]; CGPoint tempOffset; int currentCount = [self totalDataCountInScrollView]; if (MJRefreshStateRefreshing == oldState && deltaH > 0 && currentCount != _lastRefreshCount) { tempOffset = _scrollView.contentOffset; if (_appDelegate.isA) {//A视图:隐藏FooterView tempOffset.y -= 60; }else if(!_appDelegate.isA){//B视图:上拉之后显示后面的新数据 tempOffset.y += 60; } animDuration = 0; } [UIView animateWithDuration:animDuration animations:^{ _arrowImage.transform = CGAffineTransformMakeRotation(M_PI); UIEdgeInsets inset = _scrollView.contentInset; inset.bottom = _scrollViewInitInset.bottom; _scrollView.contentInset = inset; }]; if (animDuration == 0) { _scrollView.contentOffset = tempOffset; } break; } case MJRefreshStateRefreshing:{ // 记录刷新前的数量 _lastRefreshCount = [self totalDataCountInScrollView]; _statusLabel.text = MJRefreshFooterRefreshing; _arrowImage.transform = CGAffineTransformMakeRotation(M_PI); [UIView animateWithDuration:MJRefreshAnimationDuration animations:^{ UIEdgeInsets inset = _scrollView.contentInset; CGFloat bottom = MJRefreshViewHeight + _scrollViewInitInset.bottom; CGFloat deltaH = [self contentBreakView]; if (deltaH < 0) { // 如果内容高度小于view的高度 bottom -= deltaH; } inset.bottom = bottom; _scrollView.contentInset = inset; }]; break; } default: break; }}

 

MJ刷新控件MJRefreshFooterView上拉之后收不回来的解决办法