I have a UIView subclass that draws itself when -drawRect:
is called. It only takes a moment, but under extreme circumstances, such as low memory and deletion of the instance when going to another view controller, the draw function doesn't complete before the the object is deallocated.
How am I supposed to deal with this issue? The deallocation causes any calls to [self ...] to throw a EXC_BAD_ACCESS, which the drawing function does to determine how to draw itself.
Note:
I'm largely using the framework to handle memory management. The issue lies in the asynchronous calls to -drawRect:
from the CATiledLayer that the UIView uses, which come in before the UIView is released. However, since it's asynchronous, the -didReceiveMemoryWarning
runs while it's drawing, causing the view to be released in the middle of the drawing.