Contents

Views and Controls

Present your content onscreen and handle user input and events.

Overview

Views and controls are the building blocks of your app’s user interface.

[Image]

Views can host other views. Embedding one view inside another creates a containment relationship between the host view (known as the superview) and the embedded view (known as the subview). View hierarchies make it easier to manage views.

You can also use views to do any of the following:

  • Respond to touches and other events (either directly or in coordination with gesture recognizers).

  • Draw custom content using Core Graphics.

  • Respond to focus changes.

  • Animate the size, position, and appearance attributes of the view using Core Animation.

Favor AppKit views and controls whenever possible. These components adapt automatically to system changes, and many support appearance customizations to support the look and feel you want in your app. When AppKit doesn’t provide the exact view or control you need, you can create a custom view.

NSView is the root class for all views and defines their common behavior. NSControl defines additional behaviors that are specific to buttons, switches, and other views designed for user interactions.

For additional information about how to use views and controls, see Human Interface Guidelines.

Topics

View fundamentals

Container views

Content views

Controls

Liquid Glass effects

Interacting with adjacent views

Visual adornments

UI validation

Tool tips

Related types

See Also

User Interface