Skip to content

Commit

Permalink
use UIColor for the color property rather than CGColorRef; makes for …
Browse files Browse the repository at this point in the history
…easier use of UIKit UIColor, and prevents ARC auto-released UIColor from being gone by the time the reference occurs
  • Loading branch information
Kirk Beitz committed Aug 5, 2012
1 parent 1d94c3b commit 0ed184f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions MBProgressHUD.h
Expand Up @@ -312,10 +312,11 @@ typedef void (^MBProgressHUDCompletionBlock)();
@property (assign) float opacity;

/**
* The color of the HUD window. Defaults to black. If this property is set, opacity is set using this UIColor and the
* opacity property is not used
* The color of the HUD window. Defaults to black. If this property is set, color is set using
* this UIColor and the opacity property is not used. using retain because performing copy on
* UIColor base colors (like [UIColor greenColor]) cause problems with the copyZone.
*/
@property (assign) CGColorRef color;
@property (retain) UIColor *color;

/**
* The x-axis offset of the HUD relative to the centre of the superview.
Expand Down
5 changes: 3 additions & 2 deletions MBProgressHUD.m
Expand Up @@ -209,6 +209,7 @@ - (void)dealloc {
[self unregisterFromNotifications];
[self unregisterFromKVO];
#if !__has_feature(objc_arc)
[color release];
[indicator release];
[label release];
[detailsLabel release];
Expand Down Expand Up @@ -587,8 +588,8 @@ - (void)drawRect:(CGRect)rect {
}

// Set background rect color
if(self.color){
CGContextSetFillColorWithColor(context, self.color);
if (self.color) {
CGContextSetFillColorWithColor(context, self.color.CGColor);
} else {
CGContextSetGrayFillColor(context, 0.0f, self.opacity);
}
Expand Down

0 comments on commit 0ed184f

Please sign in to comment.