Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new property to allow changing animation images globally. #36

Merged
merged 1 commit into from
Apr 12, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Source/MMProgressHUD+Class.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ + (void)setDisplayStyle:(MMProgressHUDDisplayStyle)style {
[hud setDisplayStyle:style];
}

+ (void)setSpinAnimationImages:(NSArray *)animationImages {
[[MMProgressHUD sharedHUD] setSpinAnimationImages:animationImages];
}

//updates
+ (void)updateStatus:(NSString *)status {
[MMProgressHUD updateTitle:nil status:status];
Expand Down
12 changes: 12 additions & 0 deletions Source/MMProgressHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ This message will be presented to the user when a cancelBlock is present after t
*/
@property (nonatomic, strong) UIImage *successImage;

/** The array of images to be used for pending. Persistent across show calls.

The image size is currently fixed to 100x100. The image will scale to fit if the image is larger than 100x100, otherwise it will remain centered.
*/
@property (nonatomic, strong) NSArray *spinAnimationImages;

/** A block to be executed when the progress fed to the HUD reaches 100%.

This block will also fire when the progress exceeds 100%. This block was designed to be used by setting up your completion call before calling show: on the HUD, then simply feed progress updates to the HUD via the updateProgress: methods. When progress reaches 100%, this block is automatically fired. This block is automatically released after firing and is guaranteed to only fire once.
Expand Down Expand Up @@ -506,6 +512,12 @@ This message will be presented to the user when a cancelBlock is present after t
*/
+ (void)setDisplayStyle:(MMProgressHUDDisplayStyle)displayStyle;

/** Sets the animation images of the current shared instance.

@param animationImages UIImages to set animation of HUD.
*/
+ (void)setSpinAnimationImages:(NSArray *)animationImages;

@end

@interface MMProgressHUD (Deprecated)
Expand Down
6 changes: 6 additions & 0 deletions Source/MMProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ - (void)showWithTitle:(NSString *)title
else if (images.count > 0) {
self.animationImages = images;
}
else if (self.spinAnimationImages.count == 1) {
self.image = self.spinAnimationImages[0];
}
else if (self.spinAnimationImages.count > 0) {
self.animationImages = self.spinAnimationImages;
}

self.cancelBlock = cancelBlock;
self.title = title;
Expand Down