Skip to content

Commit

Permalink
Adds roundedCorner property
Browse files Browse the repository at this point in the history
  • Loading branch information
Hari Karam Singh committed Oct 1, 2013
1 parent c8e51ec commit c56e789
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions MBProgressHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ typedef void (^MBProgressHUDCompletionBlock)();
*/
@property (assign) float margin;

/**
* The corner radius for th HUD
* Defaults to 10.0
*/
@property (assign) float cornerRadius;

/**
* Cover the HUD background view with a radial gradient.
*/
Expand Down
3 changes: 2 additions & 1 deletion MBProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ - (id)initWithFrame:(CGRect)frame {
self.yOffset = 0.0f;
self.dimBackground = NO;
self.margin = 20.0f;
self.cornerRadius = 10.0f;
self.graceTime = 0.0f;
self.minShowTime = 0.0f;
self.removeFromSuperViewOnHide = NO;
Expand Down Expand Up @@ -639,7 +640,7 @@ - (void)drawRect:(CGRect)rect {
// Draw rounded HUD backgroud rect
CGRect boxRect = CGRectMake(roundf((allRect.size.width - size.width) / 2) + self.xOffset,
roundf((allRect.size.height - size.height) / 2) + self.yOffset, size.width, size.height);
float radius = 10.0f;
float radius = self.cornerRadius;
CGContextBeginPath(context);
CGContextMoveToPoint(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect));
CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMinY(boxRect) + radius, radius, 3 * (float)M_PI / 2, 0, 0);
Expand Down

0 comments on commit c56e789

Please sign in to comment.