How to crop the image in objective c?

前端 未结 2 1314
长发绾君心
长发绾君心 2020-12-09 05:58

The user can change the cropbox size which is shows default in edit screen. I tried with below code :

- (UIImage *)imageByCropping:(UIImage *)imageToCrop toR         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-09 06:56

        CGRect clippedRect  = CGRectMake(0 ,0,180 ,180);
        CGImageRef imageRef = CGImageCreateWithImageInRect(imgVw1.image.CGImage, clippedRect);
        UIImage *newImage   = [UIImage imageWithCGImage:imageRef];
        CGImageRelease(imageRef);
        imgVw1Cliped.image=newImage;
    
        NSLog(@"%d",imgVw1Cliped.image.imageOrientation);
    

提交回复
热议问题