首页 > 代码库 > 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上拉之后收不回来的解决办法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。