修改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 > && currentCount != _lastRefreshCount) { tempOffset = _scrollView.contentOffset;
if (_appDelegate.isA) {//A视图:隐藏FooterView
tempOffset.y -= 60;
}else if(!_appDelegate.isA){//B视图:上拉之后显示后面的新数据
tempOffset.y += 60;
}
animDuration = ;
} [UIView animateWithDuration:animDuration animations:^{
_arrowImage.transform = CGAffineTransformMakeRotation(M_PI);
UIEdgeInsets inset = _scrollView.contentInset;
inset.bottom = _scrollViewInitInset.bottom;
_scrollView.contentInset = inset;
}]; if (animDuration == ) {
_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 < ) { // 如果内容高度小于view的高度
bottom -= deltaH;
}
inset.bottom = bottom;
_scrollView.contentInset = inset;
}];
break;
} default:
break;
}
}