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; } }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM