Contents

Views and controls

Present your content onscreen and define the interactions allowed with that content.

Overview

Views and controls are the visual building blocks of your app’s user interface. Use them to draw and organize your app’s content onscreen.

[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 or UIKit classes.

  • Support drag and drop interactions.

  • Respond to focus changes.

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

UIView is the root class for all views and defines their common behavior. UIControl 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. To see examples of UIKit controls, see UIKit Catalog: Creating and customizing views and controls.

Topics

View fundamentals

Container views

Content views

Controls

Text views

Search field

Visual effects

Bars

Content viewer

Private Click Measurement (PCM)

SwiftUI

Related types

See Also

User interface