Sunday, October 11, 2009

iPhone dev Stupidity 36: Warning - "modifying layer that is being

How-To: Solve ‘modifying layer that is being finalized’ iPhone SDK

"The best way to solve this (that I’ve found – please post a comment if you can provide a better one) is to remove the view from it’s superview rather than release it:"

[self.popupPreviewView removeFromSuperview];
self.popupPreviewView = nil;


The point here is that if you release the subview directly, later on when the superview tries to do something (displaying etc) in the following event loop - error will happen.
So it's a best practice to remove from parent view.

No comments: