Skip to content

Commit

Permalink
Use a custom setter to make you able to change the custom view at any…
Browse files Browse the repository at this point in the history
… time, safely.

Signed-off-by: Zachary Waldowski <zwaldowski@gmail.com>
  • Loading branch information
zwaldowski committed Jan 31, 2012
1 parent 867c00c commit 7924369
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions MBProgressHUD.m
Expand Up @@ -33,6 +33,8 @@ @implementation MBProgressHUD {
CGAffineTransform _rotationTransform;
NSTimeInterval _showStarted;
__weak UIView *indicator;
__weak UILabel *label;
__weak UILabel *detailLabel;
}

#pragma mark Accessors
Expand All @@ -41,8 +43,6 @@ @implementation MBProgressHUD {

@synthesize wasHiddenBlock;

@synthesize label, detailLabel;

@synthesize minSize;

@synthesize customView;
Expand Down Expand Up @@ -380,6 +380,19 @@ - (void)setMode:(MBProgressHUDMode)newMode {
});
}

- (void)setCustomView:(UIView *)newCustomView {
if ([newCustomView isEqual:customView])
return;

customView = newCustomView;

if (mode != MBProgressHUDModeCustomView)
return;

mode = MBProgressHUDModeIndeterminate;
self.mode = MBProgressHUDModeCustomView;
}

- (CGFloat)progress {
if (mode != MBProgressHUDModeDeterminate)
return 0.0f;
Expand Down

0 comments on commit 7924369

Please sign in to comment.