// 开启图形上下文
UIGraphicsBeginImageContextWithOptions(image.size, NO, 0);
// 剪裁

UIBezierPath *path=[UIBezierPath bezierPathWithArcCenter:CGPointMake(image.size.width*0.5, image.size.height*0.5) radius:image.size.width*0.5 startAngle:0 endAngle:M_PI*2 clockwise:YES];
UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, image.size.width, image.size.height)];
[path addClip];
    
//绘制图片
[image drawAtPoint:CGPointZero];
// 从上下文中获取剪裁好的图片
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
// 关闭图形上下文
UIGraphicsEndImageContext();

相关文章:

  • 2021-09-01
  • 2022-12-23
  • 2021-09-26
  • 2021-07-31
  • 2022-12-23
  • 2021-11-30
  • 2018-06-16
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-16
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
相关资源
相似解决方案