@@ -27,25 +27,31 @@ - (BOOL)hasAnimations
27
27
{
28
28
__block BOOL result = NO ;
29
29
[self performBlockOnDescendentLayers: ^(CALayer *layer, BOOL *stop) {
30
- // explicitly exclude _UIParallaxMotionEffect as it is used in alertviews, and we don't want every alertview to be paused
31
- // explicitly exclude UITextSelectionViewCaretBlinkAnimation as it is used in textfields, and we don't want every view with textfields to be paused
32
- BOOL hasAnimation = layer.animationKeys .count != 0 && ![layer.animationKeys containsObject: @" _UIParallaxMotionEffect" ] && ![layer.animationKeys containsObject: @" UITextSelectionViewCaretBlinkAnimation" ];
33
- if (hasAnimation && !layer.hidden ) {
34
- double currentTime = CACurrentMediaTime () * [layer KIF_absoluteSpeed ];
35
-
36
- [layer.animationKeys enumerateObjectsUsingBlock: ^(NSString *animationKey, NSUInteger idx, BOOL *innerStop) {
37
- CAAnimation *animation = [layer animationForKey: animationKey];
38
- double beginTime = [animation beginTime ];
39
- double completionTime = [animation KIF_completionTime ];
40
-
41
- // Ignore long running animations (> 1 minute duration)
42
- if (currentTime >= beginTime && completionTime < currentTime + 60 && currentTime < completionTime) {
43
- result = YES ;
44
- *innerStop = YES ;
45
- *stop = YES ;
46
- }
47
- }];
48
- }
30
+ // explicitly exclude _UIParallaxMotionEffect as it is used in alertviews, and we don't want every alertview to be paused
31
+ // explicitly exclude UITextSelectionViewCaretBlinkAnimation as it is used in textfields, and we don't want every view with textfields to be paused
32
+ BOOL hasAnimation = layer.animationKeys .count != 0 && ![layer.animationKeys containsObject: @" _UIParallaxMotionEffect" ] && ![layer.animationKeys containsObject: @" UITextSelectionViewCaretBlinkAnimation" ];
33
+
34
+ // Ignore the animation of the KIF touch visualizer circle as it does not affect any view behavior
35
+ if ([NSStringFromClass (layer.delegate.class) isEqualToString: @" KIFTouchVisualizerView" ]) {
36
+ hasAnimation = NO ;
37
+ }
38
+
39
+ if (hasAnimation && !layer.hidden ) {
40
+ double currentTime = CACurrentMediaTime () * [layer KIF_absoluteSpeed ];
41
+
42
+ [layer.animationKeys enumerateObjectsUsingBlock: ^(NSString *animationKey, NSUInteger idx, BOOL *innerStop) {
43
+ CAAnimation *animation = [layer animationForKey: animationKey];
44
+ double beginTime = [animation beginTime ];
45
+ double completionTime = [animation KIF_completionTime ];
46
+
47
+ // Ignore long running animations (> 1 minute duration)
48
+ if (currentTime >= beginTime && completionTime < currentTime + 60 && currentTime < completionTime) {
49
+ result = YES ;
50
+ *innerStop = YES ;
51
+ *stop = YES ;
52
+ }
53
+ }];
54
+ }
49
55
}];
50
56
return result;
51
57
}
0 commit comments