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.

The screen for creating a reminder includes labels, switches, and many other kinds of views.

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 iOS Human Interface Guidelines.

Topics

View Fundamentals

UIView

An object that manages the content for a rectangular area on the screen.

Container Views

Organize and present large data sets using container views.

Collection Views

Display nested views using a configurable and highly customizable layout.

Table Views

Display data in a single column of customizable rows.

UIStackView

A streamlined interface for laying out a collection of views in either a column or a row.

UIScrollView

A view that allows the scrolling and zooming of its contained views.

Content Views

UIActivityIndicatorView

A view that shows that a task is in progress.

UIImageView

An object that displays a single image or a sequence of animated images in your interface.

UIPickerView

A view that uses a spinning-wheel or slot-machine metaphor to show one or more sets of values.

UIProgressView

A view that depicts the progress of a task over time.

UIWebView

A view that embeds web content in your app.

Controls

Gather input and respond to user interactions with controls.

UIControl

The base class for controls, which are visual elements that convey a specific action or intention in response to user interactions.

UIButton

A control that executes your custom code in response to user interactions.

UIDatePicker

A control used for the inputting of date and time values.

UIPageControl

A control that displays a horizontal series of dots, each of which corresponds to a page in the app’s document or other data-model entity.

UISegmentedControl

A horizontal control made of multiple segments, each segment functioning as a discrete button.

UISlider

A control used to select a single value from a continuous range of values.

UIStepper

A control used to increment or decrement a value.

UISwitch

A control that offers a binary choice, such as On/Off.

Text Views

Display and edit text using text views.

UILabel

A view that displays one or more lines of read-only text, often used in conjunction with controls to describe their intended purpose.

UITextField

An object that displays an editable text area in your interface.

UITextView

A scrollable, multiline text region.

Drag and Drop Customization

Extend the standard drag and drop support for text views to include custom types of content.

Visual Effects

UIVisualEffect

An initializer for visual effect views and blur and vibrancy effect objects.

UIVisualEffectView

An object that implements some complex visual effects.

UIVibrancyEffect

An object that amplifies and adjusts the color of the content layered behind a visual effect view.

UIBlurEffect

An object that applies a blurring effect to the content layered behind a visual effect view.

Bars

Manage the items displayed on navigation bars, tab bars, search bars, and tool bars.

UIBarItem

An abstract superclass for items that can be added to a bar that appears at the bottom of the screen.

UIBarButtonItem

A button specialized for placement on a toolbar or tab bar.

UIBarButtonItemGroup

A set of bar button items on the shortcuts bar above the keyboard on iPad.

UINavigationBar

Navigational controls displayed in a bar along the top of the screen, usually in conjunction with a navigation controller.

UISearchBar

A specialized view for receiving search-related information from the user.

UIToolbar

A control that displays one or more buttons along the bottom edge of your interface.

UITabBar

A control that displays one or more buttons in a tab bar for selecting between different subtasks, views, or modes in an app.

UITabBarItem

An item in a tab bar.

UIBarPositioning

A set of methods for defining the ways that bars can be positioned in iOS apps.

UIBarPositioningDelegate

A set of methods that support the positioning of a bar that conforms to the UIBarPositioning protocol.

Appearance Customization

UIAppearance

A collection of methods that gives you access to the appearance proxy for a class.

UIAppearanceContainer

A protocol that a class must adopt to allow appearance customization using the UIAppearance API.

Related Types

UIEdgeInsets

The inset distances for views.

NSDirectionalEdgeInsets

Edge insets that take language direction into account.

UIOffset

Defines a structure that specifies an amount to offset a position.

See Also

User Interface

View Controllers

Manage your interface using view controllers and facilitate navigation around your app's content.

View Layout

Use stack views to lay out the views of your interface automatically. Use Auto Layout when you require precise placement of your views.

Animation and Haptics

Provide feedback to users using view-based animations and haptics.

Windows and Screens

Provide a container for your view hierarchies and other content.