Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added zoom in and zoom out animations

  • Loading branch information...
commit 5b42b0fc861099021cf54a28c750d07d92e5807f 1 parent 1d94c3b
@mattrubin mattrubin authored
Showing with 10 additions and 4 deletions.
  1. +2 −1  MBProgressHUD.h
  2. +8 −3 MBProgressHUD.m
View
3  MBProgressHUD.h
@@ -50,7 +50,8 @@ typedef enum {
/** Opacity animation */
MBProgressHUDAnimationFade,
/** Opacity + scale animation */
- MBProgressHUDAnimationZoom
+ MBProgressHUDAnimationZoomIn,
+ MBProgressHUDAnimationZoomOut
} MBProgressHUDAnimation;
View
11 MBProgressHUD.m
@@ -283,7 +283,9 @@ - (void)handleMinShowTimer:(NSTimer *)theTimer {
- (void)showUsingAnimation:(BOOL)animated {
self.alpha = 0.0f;
- if (animated && animationType == MBProgressHUDAnimationZoom) {
+ if (animated && animationType == MBProgressHUDAnimationZoomIn) {
+ self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f));
+ } else if (animated && animationType == MBProgressHUDAnimationZoomOut) {
self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f));
}
self.showStarted = [NSDate date];
@@ -292,7 +294,7 @@ - (void)showUsingAnimation:(BOOL)animated {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.30];
self.alpha = 1.0f;
- if (animationType == MBProgressHUDAnimationZoom) {
+ if (animationType == MBProgressHUDAnimationZoomIn || animationType == MBProgressHUDAnimationZoomOut) {
self.transform = rotationTransform;
}
[UIView commitAnimations];
@@ -311,9 +313,12 @@ - (void)hideUsingAnimation:(BOOL)animated {
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
// 0.02 prevents the hud from passing through touches during the animation the hud will get completely hidden
// in the done method
- if (animationType == MBProgressHUDAnimationZoom) {
+ if (animationType == MBProgressHUDAnimationZoomIn) {
+ self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f));
+ } else if (animationType == MBProgressHUDAnimationZoomOut) {
self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f));
}
+
self.alpha = 0.02f;
[UIView commitAnimations];
}
Please sign in to comment.
Something went wrong with that request. Please try again.