iOS MJRefresh设置MJRefreshStateNoMoreData状态图片

时间:2021-04-29 15:27:57

MJRefresh地址

//  代码地址: https://github.com/CoderMJLee/MJRefresh
//  代码地址: http://code4app.com/ios/%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E4%B8%8B%E6%8B%89%E4%B8%8A%E6%8B%89%E5%88%B7%E6%96%B0/52326ce26803fabc46000000

MJRefresh默认情况下只能设置MJRefreshStateNoMoreData状态的文字.对于需要在MJRefreshStateNoMoreData状态设置图片的朋友.
雨季的雾在这里简单的更改MJRefresh源码,雨季的雾使用起来暂时未发现其他问题,如果出现问题,请告知,感谢!!!

列出代码:

更改MJRefreshBackGifFooter.m

- (void)setState:(MJRefreshState)state
{
    MJRefreshCheckState
    NSArray *images = self.stateImages[@(state)];
    // 根据状态做事情
    if (state == MJRefreshStatePulling || state == MJRefreshStateRefreshing) {
//        NSArray *images = self.stateImages[@(state)];
        if (images.count == 0) return;
        
        self.gifView.hidden = NO;
        [self.gifView stopAnimating];
        if (images.count == 1) { // 单张图片
            self.gifView.image = [images lastObject];
        } else { // 多张图片
            self.gifView.animationImages = images;
            self.gifView.animationDuration = [self.stateDurations[@(state)] doubleValue];
            [self.gifView startAnimating];
        }
    } else if (state == MJRefreshStateIdle) {
        self.gifView.hidden = NO;
    } else if (state == MJRefreshStateNoMoreData) {
        self.gifView.hidden = NO;
        [self.gifView stopAnimating];
        self.gifView.image = [images lastObject];
#warning 11111111111111111
        //         self.gifView.hidden = YES;
    }
}