diff --git a/Sources/KIF/Additions/CALayer-KIFAdditions.m b/Sources/KIF/Additions/CALayer-KIFAdditions.m index e99e37e9..ddc88308 100644 --- a/Sources/KIF/Additions/CALayer-KIFAdditions.m +++ b/Sources/KIF/Additions/CALayer-KIFAdditions.m @@ -27,25 +27,31 @@ - (BOOL)hasAnimations { __block BOOL result = NO; [self performBlockOnDescendentLayers:^(CALayer *layer, BOOL *stop) { - // explicitly exclude _UIParallaxMotionEffect as it is used in alertviews, and we don't want every alertview to be paused - // explicitly exclude UITextSelectionViewCaretBlinkAnimation as it is used in textfields, and we don't want every view with textfields to be paused - BOOL hasAnimation = layer.animationKeys.count != 0 && ![layer.animationKeys containsObject:@"_UIParallaxMotionEffect"] && ![layer.animationKeys containsObject:@"UITextSelectionViewCaretBlinkAnimation"]; - if (hasAnimation && !layer.hidden) { - double currentTime = CACurrentMediaTime() * [layer KIF_absoluteSpeed]; - - [layer.animationKeys enumerateObjectsUsingBlock:^(NSString *animationKey, NSUInteger idx, BOOL *innerStop) { - CAAnimation *animation = [layer animationForKey:animationKey]; - double beginTime = [animation beginTime]; - double completionTime = [animation KIF_completionTime]; - - // Ignore long running animations (> 1 minute duration) - if (currentTime >= beginTime && completionTime < currentTime + 60 && currentTime < completionTime) { - result = YES; - *innerStop = YES; - *stop = YES; - } - }]; - } + // explicitly exclude _UIParallaxMotionEffect as it is used in alertviews, and we don't want every alertview to be paused + // explicitly exclude UITextSelectionViewCaretBlinkAnimation as it is used in textfields, and we don't want every view with textfields to be paused + BOOL hasAnimation = layer.animationKeys.count != 0 && ![layer.animationKeys containsObject:@"_UIParallaxMotionEffect"] && ![layer.animationKeys containsObject:@"UITextSelectionViewCaretBlinkAnimation"]; + + // Ignore the animation of the KIF touch visualizer circle as it does not affect any view behavior + if ([NSStringFromClass(layer.delegate.class) isEqualToString:@"KIFTouchVisualizerView"]) { + hasAnimation = NO; + } + + if (hasAnimation && !layer.hidden) { + double currentTime = CACurrentMediaTime() * [layer KIF_absoluteSpeed]; + + [layer.animationKeys enumerateObjectsUsingBlock:^(NSString *animationKey, NSUInteger idx, BOOL *innerStop) { + CAAnimation *animation = [layer animationForKey:animationKey]; + double beginTime = [animation beginTime]; + double completionTime = [animation KIF_completionTime]; + + // Ignore long running animations (> 1 minute duration) + if (currentTime >= beginTime && completionTime < currentTime + 60 && currentTime < completionTime) { + result = YES; + *innerStop = YES; + *stop = YES; + } + }]; + } }]; return result; }