zoukankan      html  css  js  c++  java
  • 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; } }
  • 相关阅读:
    ajax语法结构
    数据传输编码模式的解析
    choice参数与MTV和MVC
    only和defer与select_related和prefetch_Related(面试重点)
    聚合查询、分组查询、 F与Q查询
    多表查询
    单表查询
    模板的继承和导入
    模板语法的传值和取值
    IOC依赖注入简单实例
  • 原文地址:https://www.cnblogs.com/hw140430/p/4146269.html
Copyright © 2011-2022 走看看