Protocol

UIFocusEnvironment

A set of methods that define the focus behavior for a branch of the view hierarchy.

Declaration

@protocol UIFocusEnvironment

Overview

The UIFocusEnvironment protocol provides a common interface for specifying and reacting to focus behavior throughout your app. Classes in UIKit that conform to this protocol include UIView, UIViewController, UIWindow, and UIPresentationController; in other words, classes that are either directly or indirectly in control of views on the screen.

Topics

Requesting Focus Update

When to request a focus update.

- setNeedsFocusUpdate

Submits a request to the focus engine for a focus update in this environment.

Required.

- updateFocusIfNeeded

Tells the focus engine to force a focus update immediately.

Required.

Validating Focus Movements

- shouldUpdateFocusInContext:

Returns a Boolean value indicating whether the focus engine should allow the focus update described by the specified context to occur.

Required.

Responding to Focus Updates

- didUpdateFocusInContext:withAnimationCoordinator:

Called immediately after the system updates the focus to a new view.

Required.

Controlling User-Generated Focus Movements

preferredFocusEnvironments

An array of focus environments, ordered by priority, to which this environment prefers focus to be directed during a focus update.

Required.

preferredFocusedView

Specifies the view that should be focused if this environment is focused.

Deprecated

Getting the Sound to Play During Updates

Using Custom Sounds for Focus Movement

Customize the sounds users hear when focus moves.

- soundIdentifierForFocusUpdateInContext:

Asks the delegate for the identifier of the sound to play when the object gains focus.

UIFocusSoundIdentifier

An identifier for a focus-related sound.

Checking the Ancestry of the Environment

parentFocusEnvironment

The parent focus environment for this environment.

Required.

focusItemContainer

The container for the child focus items in this focus environment.

Required.

Relationships

Inherits From

Inherited By

See Also

Focus Interactions

About Focus Interactions for Apple TV

Design and implement intuitive control schemes for menus and interactive user interface layouts.

Adding User-Focusable Elements to a tvOS App

Create intuitive and easily manipulated user-interactive controls for your tvOS app.

UIFocusSystem

Queries and reevaluates the currently focused item.

UIFocusUpdateContext

An object that provides information relevant to a specific focus update from one view to another.

UIFocusItem

An object that can become focused.

UIFocusMovementHint

Provides movement hint information for the focused item.

UIFocusItemContainer

The container responsible for providing geometric context to focus items within a given focus environment.

UIFocusItemScrollableContainer

A type of focus item container that supports automatic scrolling of focusable content.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software