views:

64

answers:

2

I'm trying to something like [view removeFromSuperview] however when I do it appears from what I've seen and what I've read in the apple documentation that the normal behaviour is to remove the superview from view as well (unless I have misread).

I'm wondering how to simply remove a view from the superview, i.e. in the case of creating a modal window, then releasing it, and redrawing again later

+1  A: 

You are probably calling removeFromSuperview on the wrong view. It should be called on the view you want to remove, not its superview.

The removeFromSuperview method removes the receiving view from its superview. It does not also remove the receiving view's superview from its superview as you suggest.

James Huddleston
+3  A: 

You are mistaken. Just call:

[subview removeFromSuperview];

Why don't you just try this out? Takes 30 seconds.

Ole Begemann