Re: Notification when change of superview (addSubView:)
Re: Notification when change of superview (addSubView:)
- Subject: Re: Notification when change of superview (addSubView:)
- From: Andy Lee <email@hidden>
- Date: Fri, 5 May 2006 12:48:47 -0400
On May 5, 2006, at 12:42 PM, Paul Thomas wrote:
I have a custom view that needs to know when it has been added to a
view as a subview (via the parent's addSubView:). I can't find a
setSuperview: in NSView, so I assume it is modified directly. Am I
missing something?
The only work around I can think of is to add a category to NSView
and override addSubView: but I'm not entirely sure how to do that.
Looks like you can override either -viewDidMoveToSuperview or -
viewWillMoveToSuperview:.
viewDidMoveToSuperview
Informs the receiver that its superview has changed (possibly to nil).
- (void)viewDidMoveToSuperview
Discussion
The default implementation does nothing; subclasses can override
this method to perform whatever actions are necessary.
viewWillMoveToSuperview:
Informs the receiver that its superview is about to change to the
specified superview (which may be nil).
- (void)viewWillMoveToSuperview:(NSView *)newSuperview
Parameters
newSuperview
A view object that will be the new superview of the receiver.
Discussion
Subclasses can override this method to perform whatever actions are
necessary.
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden