Reputation: 1128
I set the content view for the following window and now i want to remove that content view and set it to something else. I tried just setting the content view to another view and that did not work, how can i just remove it? thanks!
controlFilterBox = [[MoveFilter alloc] initWithFrame:helpWindow.frame];
[helpWindow setContentView:controlFilterBox];
[controlFilterBox release];
Upvotes: 1
Views: 1513
Reputation: 299275
You can't remove the contentView (i.e. set it to nil
). The window requires a view. You probably can get what you're trying to do by calling [controlFilterBox setNeedsDisplay:YES]
, but I typically recommend that rather than messing with contentView
itself, you make the views you want to swap to be subviews of contentView
. Then you can just swap them around as normal views with removeFromSuperview
and addSubview:
. It's just often easier than dealing with a special view like contentView
.
Upvotes: 7