Pages

August 23, 2013

How to round corners of UIView

Every default UIButton or even UIView have a great look! You see, that amazing effect of the rounding corner...
Ok, not so difficult to achieve, but while bother if you can use this useful function?


/** Round corners of a View with a radius.

 @param view A UIView or a subclass of UIView.
 @param radius Length of radius.
 @see roundCornersForView:

 */
+ (void)roundCornersForView:(UIView *)view withRadius:(CGFloat)radius {
    if (!view) { return; }
    view.layer.cornerRadius        = radius;
    view.layer.masksToBounds    = YES;
    view.layer.borderWidth        = 1.0f;
}



Download the ready-for-use source file (.m) of How to round corners of UIView

No comments:

Post a Comment