Authored by Bogdan Poplauschi
Committed by GitHub

Merge pull request #2315 from dreampiggy/improvement_image_transition_user_interaction

Add `UIViewAnimationOptionAllowUserInteraction` as default options for convenient image transition
@@ -62,7 +62,7 @@ typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished); @@ -62,7 +62,7 @@ typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished);
62 @end 62 @end
63 63
64 // Convenience way to create transition. Remember to specify the duration if needed. 64 // Convenience way to create transition. Remember to specify the duration if needed.
65 -// for UIKit, these transition just use the correspond `animationOptions` 65 +// for UIKit, these transition just use the correspond `animationOptions`. By default we enable `UIViewAnimationOptionAllowUserInteraction` to allow user interaction during transition.
66 // for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it. 66 // for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it.
67 67
68 @interface SDWebImageTransition (Conveniences) 68 @interface SDWebImageTransition (Conveniences)
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 + (SDWebImageTransition *)fadeTransition { 31 + (SDWebImageTransition *)fadeTransition {
32 SDWebImageTransition *transition = [SDWebImageTransition new]; 32 SDWebImageTransition *transition = [SDWebImageTransition new];
33 #if SD_UIKIT 33 #if SD_UIKIT
34 - transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve; 34 + transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction;
35 #else 35 #else
36 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 36 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
37 CATransition *trans = [CATransition animation]; 37 CATransition *trans = [CATransition animation];
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 + (SDWebImageTransition *)flipFromLeftTransition { 45 + (SDWebImageTransition *)flipFromLeftTransition {
46 SDWebImageTransition *transition = [SDWebImageTransition new]; 46 SDWebImageTransition *transition = [SDWebImageTransition new];
47 #if SD_UIKIT 47 #if SD_UIKIT
48 - transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft; 48 + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction;
49 #else 49 #else
50 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 50 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
51 CATransition *trans = [CATransition animation]; 51 CATransition *trans = [CATransition animation];
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 + (SDWebImageTransition *)flipFromRightTransition { 60 + (SDWebImageTransition *)flipFromRightTransition {
61 SDWebImageTransition *transition = [SDWebImageTransition new]; 61 SDWebImageTransition *transition = [SDWebImageTransition new];
62 #if SD_UIKIT 62 #if SD_UIKIT
63 - transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight; 63 + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction;
64 #else 64 #else
65 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 65 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
66 CATransition *trans = [CATransition animation]; 66 CATransition *trans = [CATransition animation];
@@ -75,7 +75,7 @@ @@ -75,7 +75,7 @@
75 + (SDWebImageTransition *)flipFromTopTransition { 75 + (SDWebImageTransition *)flipFromTopTransition {
76 SDWebImageTransition *transition = [SDWebImageTransition new]; 76 SDWebImageTransition *transition = [SDWebImageTransition new];
77 #if SD_UIKIT 77 #if SD_UIKIT
78 - transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop; 78 + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction;
79 #else 79 #else
80 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 80 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
81 CATransition *trans = [CATransition animation]; 81 CATransition *trans = [CATransition animation];
@@ -90,7 +90,7 @@ @@ -90,7 +90,7 @@
90 + (SDWebImageTransition *)flipFromBottomTransition { 90 + (SDWebImageTransition *)flipFromBottomTransition {
91 SDWebImageTransition *transition = [SDWebImageTransition new]; 91 SDWebImageTransition *transition = [SDWebImageTransition new];
92 #if SD_UIKIT 92 #if SD_UIKIT
93 - transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom; 93 + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction;
94 #else 94 #else
95 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 95 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
96 CATransition *trans = [CATransition animation]; 96 CATransition *trans = [CATransition animation];
@@ -105,7 +105,7 @@ @@ -105,7 +105,7 @@
105 + (SDWebImageTransition *)curlUpTransition { 105 + (SDWebImageTransition *)curlUpTransition {
106 SDWebImageTransition *transition = [SDWebImageTransition new]; 106 SDWebImageTransition *transition = [SDWebImageTransition new];
107 #if SD_UIKIT 107 #if SD_UIKIT
108 - transition.animationOptions = UIViewAnimationOptionTransitionCurlUp; 108 + transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction;
109 #else 109 #else
110 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 110 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
111 CATransition *trans = [CATransition animation]; 111 CATransition *trans = [CATransition animation];
@@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
120 + (SDWebImageTransition *)curlDownTransition { 120 + (SDWebImageTransition *)curlDownTransition {
121 SDWebImageTransition *transition = [SDWebImageTransition new]; 121 SDWebImageTransition *transition = [SDWebImageTransition new];
122 #if SD_UIKIT 122 #if SD_UIKIT
123 - transition.animationOptions = UIViewAnimationOptionTransitionCurlDown; 123 + transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction;
124 #else 124 #else
125 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) { 125 transition.animations = ^(__kindof NSView * _Nonnull view, NSImage * _Nullable image) {
126 CATransition *trans = [CATransition animation]; 126 CATransition *trans = [CATransition animation];