copy from Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Venders/MJRefresh/Base/MJRefreshBackFooter.m
copy to EZSDK/EZSDK/EZ/Venders/MJRefresh/MJRefresh/Base/MJRefreshBackFooter.m
File was copied from Demo/EZOpensdk_iOS_4.15.1_build20201104/Demo/EZOpenSDKDemo/Venders/MJRefresh/Base/MJRefreshBackFooter.m |
| | |
| | | // 如果正在刷新,直接返回 |
| | | if (self.state == MJRefreshStateRefreshing) return; |
| | | |
| | | _scrollViewOriginalInset = self.scrollView.contentInset; |
| | | _scrollViewOriginalInset = self.scrollView.mj_inset; |
| | | |
| | | // 当前的contentOffset |
| | | CGFloat currentOffsetY = self.scrollView.mj_offsetY; |
| | |
| | | if (self.isAutomaticallyChangeAlpha) self.alpha = 0.0; |
| | | } completion:^(BOOL finished) { |
| | | self.pullingPercent = 0.0; |
| | | |
| | | if (self.endRefreshingCompletionBlock) { |
| | | self.endRefreshingCompletionBlock(); |
| | | } |
| | | }]; |
| | | } |
| | | |
| | | CGFloat deltaH = [self heightForContentBreakView]; |
| | | // 刚刷新完毕 |
| | | if (MJRefreshStateRefreshing == oldState && deltaH > 0 && self.scrollView.totalDataCount != self.lastRefreshCount) { |
| | | if (MJRefreshStateRefreshing == oldState && deltaH > 0 && self.scrollView.mj_totalDataCount != self.lastRefreshCount) { |
| | | self.scrollView.mj_offsetY = self.scrollView.mj_offsetY; |
| | | } |
| | | } else if (state == MJRefreshStateRefreshing) { |
| | | // 记录刷新前的数量 |
| | | self.lastRefreshCount = self.scrollView.totalDataCount; |
| | | self.lastRefreshCount = self.scrollView.mj_totalDataCount; |
| | | |
| | | [UIView animateWithDuration:MJRefreshFastAnimationDuration animations:^{ |
| | | CGFloat bottom = self.mj_h + self.scrollViewOriginalInset.bottom; |
| | |
| | | }]; |
| | | } |
| | | } |
| | | |
| | | #pragma mark - 公共方法 |
| | | - (void)endRefreshing |
| | | { |
| | | if ([self.scrollView isKindOfClass:[UICollectionView class]]) { |
| | | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ |
| | | [super endRefreshing]; |
| | | }); |
| | | } else { |
| | | [super endRefreshing]; |
| | | } |
| | | } |
| | | |
| | | - (void)noticeNoMoreData |
| | | { |
| | | if ([self.scrollView isKindOfClass:[UICollectionView class]]) { |
| | | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ |
| | | [super noticeNoMoreData]; |
| | | }); |
| | | } else { |
| | | [super noticeNoMoreData]; |
| | | } |
| | | } |
| | | |
| | | #pragma mark - 私有方法 |
| | | #pragma mark 获得scrollView的内容 超出 view 的高度 |
| | | - (CGFloat)heightForContentBreakView |