YHAnimationGroup.h
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// YHAnimationGroup.h
// YHAnimationDemo
//
// Created by gaoqiang xu on 2/9/15.
// Copyright (c) 2015 gaoqiang. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "POP.h"
/**
* 动画群类
*/
@interface YHAnimationGroup : NSObject
/**
* 是否完成
*/
@property (assign, nonatomic, getter = isFinished, readonly) BOOL finished;
/**
* 完成回调
*/
@property (copy, nonatomic) void (^completionBlock)(BOOL finished);
/**
* 添加POP动画
*
* @param animation POPAnimation实例
*/
- (void)addAnimation:(POPAnimation *)animation;
/**
*
*
* @param animation POPAnimation实例
* @param finished 标记是否完成
*/
- (void)removeAnimation:(POPAnimation *)animation finished:(BOOL)finished;
@end
/**
* NSObject扩展,快速使用动画群做动画
*/
@interface NSObject (YHAnimationGroup)
/**
* 使用动画群YHAnimationGroup做动画
*
* @param animations 动画代码
* @param completion 完成回调
*/
+ (void)pop_animate:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
@end
#ifdef YHANIMATE_SHORTHAND
@interface NSObject (YHAnimationGroup_DropPrefix)
+ (void)animate:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
@end
@implementation NSObject (YHAnimationGroup_DropPrefix)
+ (void)animate:(void (^)(void))animations completion:(void (^)(BOOL finished))completion {
[self pop_animate:animations completion:completion];
}
@end
#endif