CGImage of UIImage return NULL

后端 未结 5 683
情深已故
情深已故 2021-01-12 05:16

I created a function for splitting an image into multiple images, but when I take take the CGImage of the UIImage, the CGImage returns NULL

NSArray* splitIma         


        
5条回答
  •  执笔经年
    2021-01-12 05:41

    It happens in some cases when we try to crop image. I found the solution like this try this may be this can help you:-

    NSData *imageData = UIImageJPEGRepresentation(yourImage, 0.9);
    newImage = [UIImage imageWithData:imageData];
    

提交回复
热议问题