- (UIImage *)roundedImageWithCornerRadius:(CGFloat)cornerRadius {
UIGraphicsBeginImageContextWithOptions(self.size, NO, self.scale);
UIBezierPath *clippingPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.size.width, self.size.height) cornerRadius:cornerRadius];
[clippingPath addClip];
[self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)];
UIImage *roundedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return roundedImage;
}
UIImage设置圆角
最新推荐文章于 2023-12-26 08:00:41 发布