.....................UIButton.....................
+(UIButton *)setCornerRadiusOfButton:(CGFloat)cornerRadius corner:(UIRectCorner)corner view:(UIButton *)view{
UIBezierPath *maskPath1;
maskPath1 = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:(corner) cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
CAShapeLayer *maskLayer1 = [[CAShapeLayer alloc] init];
maskLayer1.frame = view.bounds;
maskLayer1.path = maskPath1.CGPath;
view.layer.mask = maskLayer1;
return view;
}
.....................UIImageView.....................
+(UIImageView *)setCornerRadiusOfView:(CGFloat)cornerRadius corner:(UIRectCorner)corner view:(UIImageView *)view{
UIBezierPath *maskPath1;
maskPath1 = [UIBezierPath bezierPathWithRoundedRect:view.boundsbyRoundingCorners:(corner) cornerRadii:CGSizeMake(cornerRadius, cornerRadius)];
CAShapeLayer *maskLayer1 = [[CAShapeLayer alloc] init];
maskLayer1.frame = view.bounds;
maskLayer1.path = maskPath1.CGPath;
view.layer.mask = maskLayer1;
return view;
}
No comments:
Post a Comment