- (void)drawcornder {

    UIImage *image = [UIImage imageNamed:@"image1"];

    

    // Begin a new image that will be the new image with the rounded corners

    // (here with the size of an UIImageView)

    UIGraphicsBeginImageContextWithOptions(_image.bounds.size, NO, 1.0);

    

    // Add a clip before drawing anything, in the shape of an rounded rect

    [[UIBezierPath bezierPathWithRoundedRect:_image.bounds

                                cornerRadius:10.0] addClip];

    // Draw your image

    [image drawInRect:_image.bounds];

    

    // Get the image, here setting the UIImageView image

    _image.image = UIGraphicsGetImageFromCurrentImageContext();

    

    // Lets forget about that we were drawing

    UIGraphicsEndImageContext();

}

相关文章:

  • 2021-12-04
  • 2022-12-23
  • 2021-06-16
  • 2021-07-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-02-16
  • 2021-07-31
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案