When you send performSelector:withObject:afterDelay:
to your view, the view essentially creates a timer. The timer retains the view, and the argument object (presumably a UIColor
in your case). So even if you remove the view from its superview, the timer still retains the view and prevents it from being deallocated.
When the timer fires, it will change the (off-screen) view's background color, then release the view. If that was the last strong reference to the view, the view will then be deallocated.
When you change the background color of a view that's not in a window hierarchy, the view just remembers its new background color setting, but it doesn't do anything else like try to draw itself on the screen.
So using performSelector:withObject:afterDelay:
to change your view's background color should not cause any problems even if you remove the view from its superview before the delay expires.