@@ -1218,12 +1218,12 @@ - (void)setAngle:(NSInteger)angle
1218
1218
// on direction
1219
1219
if (newAngle >= 0 ) {
1220
1220
while (labs (self.angle ) != labs (newAngle)) {
1221
- [self rotateImageNinetyDegreesAnimated: NO clockwise: YES ];
1221
+ [self rotateImageNinetyDegreesAnimated: NO clockwise: YES completion: nil ];
1222
1222
}
1223
1223
}
1224
1224
else {
1225
1225
while (-labs (self.angle ) != -labs (newAngle)) {
1226
- [self rotateImageNinetyDegreesAnimated: NO clockwise: NO ];
1226
+ [self rotateImageNinetyDegreesAnimated: NO clockwise: NO completion: nil ];
1227
1227
}
1228
1228
}
1229
1229
}
@@ -1503,12 +1503,12 @@ - (void)setAspectRatio:(CGSize)aspectRatio animated:(BOOL)animated
1503
1503
completion: nil ];
1504
1504
}
1505
1505
1506
- - (void )rotateImageNinetyDegreesAnimated : (BOOL )animated
1506
+ - (void )rotateImageNinetyDegreesAnimated : (BOOL )animated completion : ( void (^)( BOOL completed)) completionHandler
1507
1507
{
1508
- [self rotateImageNinetyDegreesAnimated: animated clockwise: NO ];
1508
+ [self rotateImageNinetyDegreesAnimated: animated clockwise: NO completion: completionHandler ];
1509
1509
}
1510
1510
1511
- - (void )rotateImageNinetyDegreesAnimated : (BOOL )animated clockwise : (BOOL )clockwise
1511
+ - (void )rotateImageNinetyDegreesAnimated : (BOOL )animated clockwise : (BOOL )clockwise completion : ( void (^)( BOOL completed)) completionHandler
1512
1512
{
1513
1513
// Only allow one rotation animation at a time
1514
1514
if (self.rotateAnimationInProgress )
@@ -1666,7 +1666,7 @@ - (void)rotateImageNinetyDegreesAnimated:(BOOL)animated clockwise:(BOOL)clockwis
1666
1666
} completion: ^(BOOL complete) {
1667
1667
self.rotateAnimationInProgress = NO ;
1668
1668
[snapshotView removeFromSuperview ];
1669
-
1669
+
1670
1670
// If the aspect ratio lock is not enabled, allow a swap
1671
1671
// If the aspect ratio lock is on, allow a aspect ratio swap
1672
1672
// only if the allowDimensionSwap option is specified.
@@ -1677,6 +1677,10 @@ - (void)rotateImageNinetyDegreesAnimated:(BOOL)animated clockwise:(BOOL)clockwis
1677
1677
// This will animate the aspect ratio back to the desired locked ratio after the image is rotated.
1678
1678
[self setAspectRatio: self .aspectRatio animated: animated];
1679
1679
}
1680
+
1681
+ if (completionHandler) {
1682
+ completionHandler (complete);
1683
+ }
1680
1684
}];
1681
1685
}];
1682
1686
}
0 commit comments