Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adds roundedCorner property #167

Merged
merged 1 commit into from

2 participants

@Air-Craft

Because "square corners" are the new "rounded corners" and "rounded corners" are like, so, square.

Great library btw, thx!

@matej matej merged commit bb4a35b into jdg:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 1, 2013
  1. Adds roundedCorner property

    Hari Karam Singh authored
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +6 −0 MBProgressHUD.h
  2. +2 −1  MBProgressHUD.m
View
6 MBProgressHUD.h
@@ -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
3  MBProgressHUD.m
@@ -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);
Something went wrong with that request. Please try again.