Converting an UIview unto UIimage causing memory leak

前端 未结 2 766
梦如初夏
梦如初夏 2021-02-06 16:40

I\'m developing an app for iPhone using a coverFlow view, when the app is building the cards it is using a UIView in order to add labels and other stuff. Then I convert the UIV

2条回答
  •  不知归路
    2021-02-06 17:14

    There is no memory leak apparent in the code snippet you provided. That operation could not be performed on a background thread because of UIGraphicsBeginImageContext(), so you should have an NSAutoreleasePool in place (the return value of UIGraphicsGetImageFromCurrentContext() is autoreleased). Without further information, its impossible to tell where the memory leak could be - I suggest you look at whatever objects eventually own the viewImage object and make sure you are properly releasing the UIImage if you retain it.

提交回复
热议问题