开发者

How do I remove a view from a super view without unloading the superview?

I'm trying to som开发者_StackOverflowething 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


You are mistaken. Just call:

[subview removeFromSuperview];

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜