Contents

addSubview(_:)

Adds a view to the view’s subviews so it’s displayed above its siblings.

Declaration

func addSubview(_ view: NSView)

Parameters

  • view:

    The view to add to the view as a subview.

Discussion

This method also sets the view as the next responder of aView.

The view retains aView. If you use removeFromSuperview() to remove aView from the view hierarchy, aView is released. If you want to keep using aView after removing it from the view hierarchy (if, for example, you are swapping through a number of views), you must retain it before invoking removeFromSuperview().

See Also

Related Documentation

Adding and Removing Subviews