- -(UIImage*)
circleImage:(UIImage*) image withParam:(CGFloat) inset { -
UIGraphicsBeginImageCont ext(image.size); -
CGContextRef context = UIGraphicsGetCurrentCont ext(); -
CGContextSetLineWidth(context, 2); -
CGContextSetStrokeColorW ithColor(context, [UIColor redColor].CGColor); -
CGRect rect = CGRectMake(inset, inset, image.size.width - inset * 2.0f, image.size.height - inset * 2.0f); -
CGContextAddEllipseInRec t(context, rect); -
CGContextClip(context); -
-
[image drawInRect:rect]; -
CGContextAddEllipseInRec t(context, rect); -
CGContextStrokePath(context); -
UIImage *newimg = UIGraphicsGetImageFromCu rrentImageContext(); -
UIGraphicsEndImageContex t(); -
return newimg; - }
iOS 将UIImage裁剪成圆形
最新推荐文章于 2019-07-08 23:12:00 发布