imageWithCGImage and memory

前端 未结 8 407
既然无缘
既然无缘 2020-12-10 02:24

If I use [UIImage imageWithCGImage:], passing in a CGImageRef, do I then release the CGImageRef or does UIImage take care of this itse

8条回答
  •  無奈伤痛
    2020-12-10 02:56

    I agree with you -- the documentation is muddled at best for this API. Based on your experiences, then, I would conclude that you are responsible for the lifetime of both objects - the UIImage and the CGImageRef. On top of that you have to make sure the lifetime of the CGImageRef is at least as long as the UIImage (for obvious reasons).

提交回复
热议问题