How do you crop an image in iOS

后端 未结 4 598
我在风中等你
我在风中等你 2020-12-13 19:05

I have a photo app where you can add stickers in one section. When you\'re finished I want to save the image. Here is the code that I have to do that.

if         


        
4条回答
  •  我在风中等你
    2020-12-13 19:30

    How about something like this

    CGRect clippedRect  = CGRectMake(self.view.frame.origin.x+91, self.view.frame.origin.y, self.view.frame.size.width-91*2, self.view.frame.size.height-220);
    CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], clippedRect);
    UIImage *newImage   = [UIImage imageWithCGImage:imageRef];
    CGImageRelease(imageRef);
    

提交回复
热议问题