Commit 3030898c authored by luyueming's avatar luyueming

gif类放到库里

parent 9b732aa2
......@@ -5,7 +5,7 @@ PODS:
- GMCache
- MagicalRecord
- MJExtension
- GMRefresh (1.0.4):
- GMRefresh (1.0.6):
- GMPhobos
- MJRefresh
- MagicalRecord (2.3.2):
......@@ -43,7 +43,7 @@ CHECKOUT OPTIONS:
SPEC CHECKSUMS:
GMCache: b78d8e46db864405e91d226ce640cc80d966c611
GMPhobos: abab7c666c8a75549adea937e40e101d4d341b0d
GMRefresh: 635099e4d381d10564d7991d449898f0b54dfe74
GMRefresh: 64bccb48e2161969e5877168c33a7927d3020e42
MagicalRecord: 53bed74b4323b930992a725be713e53b37d19755
MJExtension: 635f2c663dcb1bf76fa4b715b2570a5710aec545
MJRefresh: 53e3e3219f204425ee6d3e62e8733d3295944cd6
......
//
// GMGifImageView.h
// Gengmei
//
// Created by lizhen on 2019/3/15.
// Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//
@interface GMGifImageView : UIImageView
- (instancetype)initWithSuperView:(UIView *)superView;
/**
开始下拉刷新动画, 参数为是否需要回到顶部动画
@param topAnimation 回到顶部是否需要动画
*/
- (void)startGifRefresh:(BOOL)topAnimation;
- (void)stopGifRefresh;
@end
//
// GMGifImageView.m
// Gengmei
//
// Created by lizhen on 2019/3/15.
// Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//
#import "GMGifImageView.h"
#import <MJRefresh/MJRefresh.h>
#import "GMRefreshConstant.h"
@interface GMGifImageView ()
@property (nonatomic, strong) NSMutableArray *refreshingImages;
@property (nonatomic, strong) UITableView *table;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, assign) BOOL isTable;
@end
@implementation GMGifImageView
- (instancetype)initWithSuperView:(UIView *)superView {
if (self = [super init]) {
if ([superView isKindOfClass:[UICollectionView class]]) {
self.isTable = NO;
self.collectionView = (UICollectionView *)superView;
} else if ([superView isKindOfClass:[UITableView class]]) {
self.isTable = YES;
self.table = (UITableView *)superView;
}
self.hidden = YES;
NSTimeInterval duration = self.refreshingImages.count*0.1;
self.animationImages = self.refreshingImages;
self.animationRepeatCount = MAXFLOAT;
self.animationDuration = duration;
[superView addSubview:self];
CGFloat width = 100;
CGFloat x = (superView.frame.size.width -width) * 0.5;
self.frame = CGRectMake(x, -100, width, width);
}
return self;
}
- (NSMutableArray *)refreshingImages {
if (!_refreshingImages) {
_refreshingImages = [NSMutableArray arrayWithCapacity:1];
for (NSUInteger i = 1; i<=23; i++) {
NSString *imageName = [NSString stringWithFormat:@"pullLoading%ld", i];
NSString *imagePath = GMRefreshImageName(imageName);
UIImage *image = [UIImage imageNamed:imagePath];
[_refreshingImages addObject:image];
}
}
return _refreshingImages;
}
- (void)startGifRefresh:(BOOL)topAnimation {
/* 根据图片设置控件的高度 */
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
self.hidden = NO;
[self startAnimating];
});
if (self.isTable) {
[self.table setContentOffset:CGPointZero animated:topAnimation];
[self.table.mj_header beginRefreshing];
} else {
[self.collectionView setContentOffset:CGPointZero animated:topAnimation];
[self.collectionView.mj_header beginRefreshing];
}
}
- (void)stopGifRefresh {
[self stopAnimating];
self.hidden = YES;
}
@end
......@@ -37,7 +37,7 @@
- (void)executeRefreshingCallback
{
// 上拉数据时,页面上拉次数++
self.pageCtrl.up_loading_times++;
// self.pageCtrl.up_loading_times++;
dispatch_async(dispatch_get_main_queue(), ^{
MJRefreshHeader *header = _scrollView.mj_header;
......
......@@ -99,8 +99,8 @@
- (void)executeRefreshingCallback
{
// 下拉加载时,页面下拉次数++,同时将当前数据进行上报
self.pageCtrl.down_loading_times++;
[[GMExposureManager sharedManager] endExpoTrcakerForPageCtrl:self.pageCtrl];
// self.pageCtrl.down_loading_times++;
// [[GMExposureManager sharedManager] endExpoTrcakerForPageCtrl:self.pageCtrl];
dispatch_async(dispatch_get_main_queue(), ^{
MJRefreshFooter *footer = _scrollView.mj_footer;
if (footer && [footer isRefreshing]) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment