Permalink
Browse files

Adds roundedCorner property

  • Loading branch information...
1 parent c8e51ec commit c56e789aec8f8ee62d476de4cc9624b32a13cada Hari Karam Singh committed Oct 1, 2013
Showing with 8 additions and 1 deletion.
  1. +6 −0 MBProgressHUD.h
  2. +2 −1 MBProgressHUD.m
View
@@ -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.
*/
View
@@ -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;
@@ -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);

0 comments on commit c56e789

Please sign in to comment.