• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Notification when change of superview (addSubView:)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Notification when change of superview (addSubView:) (From: Paul Thomas <email@hidden>)

  • Prev by Date: Notification when change of superview (addSubView:)
  • Next by Date: Re: Notification when change of superview (addSubView:)
  • Previous by thread: Notification when change of superview (addSubView:)
  • Next by thread: Re: Notification when change of superview (addSubView:)
  • Index(es):
    • Date
    • Thread