you can use CGDataProvider to open CGImage .
for example, you can use CGImageCreateWithPNGDataProvider , and the data provider will reference CFURL . you can use a similar approach for CFData .
then you can use CGImage or hop back to the main thread and create a UIImage .
Finally, you can simply load CFData or NSData from the secondary stream, and then return to the main stream to do something with it.
it can also be noted that UIImage is an immutable type and in some cases uses a cache. if you download the same view multiple times, make sure you do not turn off this optimization.
source share