Informs the view that it’s being added to the view hierarchy of the specified window object (which may be
- macOS 10.0+
The window object that will be at the root of the view's new view hierarchy. If the view is being removed from a window and there is no new window, this parameter is
AppKit calls this method when the window of a view changes. It also calls it in cases where a view stays in the same window but its position in its view hierarchy changes. The view that moved also calls this method on all of its subviews, giving each of them a chance to respond to the change.
Subclasses can override this method to perform whatever actions are necessary. For example, when a window is deallocated, you can use this method to remove notification observers and bindings associated with the view.
When a window is deallocated, AppKit calls this method for each view in the window, passing
nil for the
new parameter. AppKit does not necessarily call this method when closing a window, though. Closing a window usually just hides the window. Closed windows are deallocated only if their
released method returns