How exactly to make a CGImageRef from an image on disk

后端 未结 2 526
忘了有多久
忘了有多久 2020-12-14 05:51

I\'ve looked around everywhere to no avail. I\'m doing some image loading in a thread and since UIKit is not thread safe I\'m going to have to store the images as CGImageRef

2条回答
  •  甜味超标
    2020-12-14 06:12

    I think the simplest way is to use UIKit and use the CGImage propriety of UIImage.

    Something like that :

    UIImage* image = [UIImage imageNamed:@"Your Image.png"];
    CGImageRef imageRef = image.CGImage;
    

提交回复
热议问题