What's the right memory management pattern for buffer->CGImageRef->UIImage?

后端 未结 4 1857
Happy的楠姐
Happy的楠姐 2021-02-07 14:11

I have a function that takes some bitmap data and returns a UIImage * from it. It looks something like so:

UIImage * makeAnImage() 
{
    unsigned char * pixels          


        
4条回答
  •  逝去的感伤
    2021-02-07 14:48

    Aye, this code makes me queasy. As an old rule-to-live by, I try not to mix and match C and C++, and C/Objective-C in the same function/method/selector.

    How about breaking this up into two methods. Have change this makeAnImage into makeAnImageRef and pull up the UIImage creation into another Obj-C selector.

提交回复
热议问题