Trait UIFocusEnvironment

Source
pub unsafe trait UIFocusEnvironment: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    unsafe fn preferredFocusEnvironments(
        &self,
    ) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>
       where Self: Sized + Message { ... }
    unsafe fn parentFocusEnvironment(
        &self,
    ) -> Option<Retained<ProtocolObject<dyn UIFocusEnvironment>>>
       where Self: Sized + Message { ... }
    unsafe fn focusItemContainer(
        &self,
    ) -> Option<Retained<ProtocolObject<dyn UIFocusItemContainer>>>
       where Self: Sized + Message { ... }
    unsafe fn setNeedsFocusUpdate(&self)
       where Self: Sized + Message { ... }
    unsafe fn updateFocusIfNeeded(&self)
       where Self: Sized + Message { ... }
    unsafe fn shouldUpdateFocusInContext(
        &self,
        context: &UIFocusUpdateContext,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn didUpdateFocusInContext_withAnimationCoordinator(
        &self,
        context: &UIFocusUpdateContext,
        coordinator: &UIFocusAnimationCoordinator,
    )
       where Self: Sized + Message { ... }
    unsafe fn soundIdentifierForFocusUpdateInContext(
        &self,
        context: &UIFocusUpdateContext,
    ) -> Option<Retained<UIFocusSoundIdentifier>>
       where Self: Sized + Message { ... }
    unsafe fn preferredFocusedView(&self) -> Option<Retained<UIView>>
       where Self: Sized + Message { ... }
    unsafe fn focusGroupIdentifier(&self) -> Option<Retained<NSString>>
       where Self: Sized + Message { ... }
}
Available on crate feature UIFocus only.
Expand description

Objects conforming to UIFocusEnvironment influence and respond to focus behavior within a specific area of the screen that they control.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn preferredFocusEnvironments( &self, ) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>
where Self: Sized + Message,

The preferred focus environments define where to search for the default focused item in an environment, such as when focus updates programmatically. Starting from the target environment, each preferred focus environment is recursively searched in the order of the array until an eligible, focusable item is found. Preferred focus environments can include focusable and non-focusable items, in addition to non-item environments. Returning an empty array is equivalent to returning an array containing only ‘self’.

Source

unsafe fn parentFocusEnvironment( &self, ) -> Option<Retained<ProtocolObject<dyn UIFocusEnvironment>>>
where Self: Sized + Message,

The parent focus environment of this environment, or nil if no parent exists. NOTE: If you implement this method, you must return a non-nil value for parent focus environment, otherwise your focus environment will not participate in focus interactions.

Source

unsafe fn focusItemContainer( &self, ) -> Option<Retained<ProtocolObject<dyn UIFocusItemContainer>>>
where Self: Sized + Message,

The container of any child focus items in this focus environment, or nil if no container exists.

Source

unsafe fn setNeedsFocusUpdate(&self)
where Self: Sized + Message,

Marks this environment as needing a focus update, which if accepted will attempt to reset focus to this environment, or one of its preferred focus environments, on the next update cycle. If this environment does not currently contain the focused item, then calling this method has no effect. If a parent of this environment is also requesting focus, then this environment’s request is rejected in favor of the parent’s. NOTE: If you provide your own implementation, it must call [[UIFocusSystem focusSystemForEnvironment:self] requestFocusUpdateToEnvironment:self];

Source

unsafe fn updateFocusIfNeeded(&self)
where Self: Sized + Message,

Forces focus to be updated immediately. If there is an environment that has requested a focus update via -setNeedsFocusUpdate, and the request was accepted, then focus will be updated to that environment or one of its preferred focus environments. NOTE: If you provide your own implementation, it must call [[UIFocusSystem focusSystemForEnvironment:self] updateFocusIfNeeded];.

Source

unsafe fn shouldUpdateFocusInContext( &self, context: &UIFocusUpdateContext, ) -> bool
where Self: Sized + Message,

Asks whether the system should allow a focus update to occur.

Source

unsafe fn didUpdateFocusInContext_withAnimationCoordinator( &self, context: &UIFocusUpdateContext, coordinator: &UIFocusAnimationCoordinator, )
where Self: Sized + Message,

Available on crate feature UIFocusAnimationCoordinator only.

Called when the screen’s focused item has been updated to a new item. Use the animation coordinator to schedule focus-related animations in response to the update.

Source

unsafe fn soundIdentifierForFocusUpdateInContext( &self, context: &UIFocusUpdateContext, ) -> Option<Retained<UIFocusSoundIdentifier>>
where Self: Sized + Message,

Specifies an identifier corresponding to a sound that should be played for a focus update. Return UIFocusSoundIdentifierNone to opt out of sounds, UIFocusSoundIdentifierDefault for the system default sounds, a previously registered identifier for a custom sound, or nil to defer the decision to the parent.

Source

unsafe fn preferredFocusedView(&self) -> Option<Retained<UIView>>
where Self: Sized + Message,

👎Deprecated
Available on crate features UIResponder and UIView only.
Source

unsafe fn focusGroupIdentifier(&self) -> Option<Retained<NSString>>
where Self: Sized + Message,

The identifier of the focus group that this view belongs to. If this is nil, subviews inherit their superview’s focus group.

Trait Implementations§

Source§

impl ProtocolType for dyn UIFocusEnvironment

Source§

const NAME: &'static str = "UIFocusEnvironment"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn UIFocusEnvironment

Implementations on Foreign Types§

Source§

impl<T> UIFocusEnvironment for ProtocolObject<T>

Implementors§

Source§

impl UIFocusEnvironment for UIActionSheet

Available on crate features UIResponder and UIView and UIActionSheet only.
Source§

impl UIFocusEnvironment for UIActivityIndicatorView

Available on crate features UIResponder and UIView and UIActivityIndicatorView only.
Source§

impl UIFocusEnvironment for UIActivityViewController

Available on crate features UIResponder and UIViewController and UIActivityViewController only.
Source§

impl UIFocusEnvironment for UIAlertController

Available on crate features UIResponder and UIViewController and UIAlertController only.
Source§

impl UIFocusEnvironment for UIAlertView

Available on crate features UIResponder and UIView and UIAlertView only.
Source§

impl UIFocusEnvironment for UIButton

Available on crate features UIControl and UIResponder and UIView and UIButton only.
Source§

impl UIFocusEnvironment for UICalendarView

Available on crate features UIResponder and UIView and UICalendarView only.
Source§

impl UIFocusEnvironment for UICloudSharingController

Available on crate features UIResponder and UIViewController and UICloudSharingController only.
Source§

impl UIFocusEnvironment for UICollectionReusableView

Available on crate features UIResponder and UIView and UICollectionViewCell only.
Source§

impl UIFocusEnvironment for UICollectionView

Available on crate features UIResponder and UIScrollView and UIView and UICollectionView only.
Source§

impl UIFocusEnvironment for UICollectionViewCell

Available on crate features UIResponder and UIView and UICollectionViewCell only.
Source§

impl UIFocusEnvironment for UICollectionViewController

Available on crate features UIResponder and UIViewController and UICollectionViewController only.
Source§

impl UIFocusEnvironment for UICollectionViewListCell

Available on crate features UICollectionViewCell and UIResponder and UIView and UICollectionViewListCell only.
Source§

impl UIFocusEnvironment for UIColorPickerViewController

Available on crate features UIResponder and UIViewController and UIColorPickerViewController only.
Source§

impl UIFocusEnvironment for UIColorWell

Available on crate features UIControl and UIResponder and UIView and UIColorWell only.
Source§

impl UIFocusEnvironment for UIContentUnavailableView

Available on crate features UIResponder and UIView and UIContentUnavailableView only.
Source§

impl UIFocusEnvironment for UIControl

Available on crate features UIResponder and UIView and UIControl only.
Source§

impl UIFocusEnvironment for UIDatePicker

Available on crate features UIControl and UIResponder and UIView and UIDatePicker only.
Source§

impl UIFocusEnvironment for UIDocumentBrowserViewController

Available on crate features UIResponder and UIViewController and UIDocumentBrowserViewController only.
Source§

impl UIFocusEnvironment for UIDocumentMenuViewController

Available on crate features UIResponder and UIViewController and UIDocumentMenuViewController only.
Source§

impl UIFocusEnvironment for UIDocumentPickerExtensionViewController

Available on crate features UIResponder and UIViewController and UIDocumentPickerExtensionViewController only.
Source§

impl UIFocusEnvironment for UIDocumentPickerViewController

Available on crate features UIResponder and UIViewController and UIDocumentPickerViewController only.
Source§

impl UIFocusEnvironment for UIDocumentViewController

Available on crate features UIResponder and UIViewController and UIDocumentViewController only.
Source§

impl UIFocusEnvironment for UIEventAttributionView

Available on crate features UIResponder and UIView and UIEventAttributionView only.
Source§

impl UIFocusEnvironment for UIFontPickerViewController

Available on crate features UIResponder and UIViewController and UIFontPickerViewController only.
Source§

impl UIFocusEnvironment for UIImagePickerController

Available on crate features UINavigationController and UIResponder and UIViewController and UIImagePickerController only.
Source§

impl UIFocusEnvironment for UIImageView

Available on crate features UIResponder and UIView and UIImageView only.
Source§

impl UIFocusEnvironment for UIInputView

Available on crate features UIResponder and UIView and UIInputView only.
Source§

impl UIFocusEnvironment for UIInputViewController

Available on crate features UIResponder and UIViewController and UIInputViewController only.
Source§

impl UIFocusEnvironment for UILabel

Available on crate features UIResponder and UIView and UILabel only.
Source§

impl UIFocusEnvironment for UIListContentView

Available on crate features UIResponder and UIView and UIListContentConfiguration only.
Source§

impl UIFocusEnvironment for UINavigationBar

Available on crate features UIResponder and UIView and UINavigationBar only.
Source§

impl UIFocusEnvironment for UINavigationController

Available on crate features UIResponder and UIViewController and UINavigationController only.
Source§

impl UIFocusEnvironment for UIPageControl

Available on crate features UIControl and UIResponder and UIView and UIPageControl only.
Source§

impl UIFocusEnvironment for UIPageViewController

Available on crate features UIResponder and UIViewController and UIPageViewController only.
Source§

impl UIFocusEnvironment for UIPasteControl

Available on crate features UIControl and UIResponder and UIView and UIPasteControl only.
Source§

impl UIFocusEnvironment for UIPickerView

Available on crate features UIResponder and UIView and UIPickerView only.
Source§

impl UIFocusEnvironment for UIPopoverBackgroundView

Available on crate features UIResponder and UIView and UIPopoverBackgroundView only.
Source§

impl UIFocusEnvironment for UIPopoverPresentationController

Available on crate features UIPresentationController and UIPopoverPresentationController only.
Source§

impl UIFocusEnvironment for UIPresentationController

Available on crate feature UIPresentationController only.
Source§

impl UIFocusEnvironment for UIProgressView

Available on crate features UIResponder and UIView and UIProgressView only.
Source§

impl UIFocusEnvironment for UIReferenceLibraryViewController

Available on crate features UIResponder and UIViewController and UIReferenceLibraryViewController only.
Source§

impl UIFocusEnvironment for UIRefreshControl

Available on crate features UIControl and UIResponder and UIView and UIRefreshControl only.
Source§

impl UIFocusEnvironment for UIScrollView

Available on crate features UIResponder and UIView and UIScrollView only.
Source§

impl UIFocusEnvironment for UISearchBar

Available on crate features UIResponder and UIView and UISearchBar only.
Source§

impl UIFocusEnvironment for UISearchContainerViewController

Available on crate features UIResponder and UIViewController and UISearchContainerViewController only.
Source§

impl UIFocusEnvironment for UISearchController

Available on crate features UIResponder and UIViewController and UISearchController only.
Source§

impl UIFocusEnvironment for UISearchTextField

Available on crate features UIControl and UIResponder and UITextField and UIView and UISearchTextField only.
Source§

impl UIFocusEnvironment for UISegmentedControl

Available on crate features UIControl and UIResponder and UIView and UISegmentedControl only.
Source§

impl UIFocusEnvironment for UISheetPresentationController

Available on crate features UIPresentationController and UISheetPresentationController only.
Source§

impl UIFocusEnvironment for UISlider

Available on crate features UIControl and UIResponder and UIView and UISlider only.
Source§

impl UIFocusEnvironment for UISplitViewController

Available on crate features UIResponder and UIViewController and UISplitViewController only.
Source§

impl UIFocusEnvironment for UIStackView

Available on crate features UIResponder and UIView and UIStackView only.
Source§

impl UIFocusEnvironment for UIStandardTextCursorView

Available on crate features UIResponder and UIView and UIStandardTextCursorView only.
Source§

impl UIFocusEnvironment for UIStepper

Available on crate features UIControl and UIResponder and UIView and UIStepper only.
Source§

impl UIFocusEnvironment for UISwitch

Available on crate features UIControl and UIResponder and UIView and UISwitch only.
Source§

impl UIFocusEnvironment for UITabBar

Available on crate features UIResponder and UIView and UITabBar only.
Source§

impl UIFocusEnvironment for UITabBarController

Available on crate features UIResponder and UIViewController and UITabBarController only.
Source§

impl UIFocusEnvironment for UITableView

Available on crate features UIResponder and UIScrollView and UIView and UITableView only.
Source§

impl UIFocusEnvironment for UITableViewCell

Available on crate features UIResponder and UIView and UITableViewCell only.
Source§

impl UIFocusEnvironment for UITableViewController

Available on crate features UIResponder and UIViewController and UITableViewController only.
Source§

impl UIFocusEnvironment for UITableViewHeaderFooterView

Available on crate features UIResponder and UIView and UITableViewHeaderFooterView only.
Source§

impl UIFocusEnvironment for UITextField

Available on crate features UIControl and UIResponder and UIView and UITextField only.
Source§

impl UIFocusEnvironment for UITextFormattingViewController

Available on crate features UIResponder and UIViewController and UITextFormattingViewController only.
Source§

impl UIFocusEnvironment for UITextView

Available on crate features UIResponder and UIScrollView and UIView and UITextView only.
Source§

impl UIFocusEnvironment for UIToolbar

Available on crate features UIResponder and UIView and UIToolbar only.
Source§

impl UIFocusEnvironment for UIVideoEditorController

Available on crate features UINavigationController and UIResponder and UIViewController and UIVideoEditorController only.
Source§

impl UIFocusEnvironment for UIView

Available on crate features UIResponder and UIView only.
Source§

impl UIFocusEnvironment for UIViewController

Available on crate features UIResponder and UIViewController only.
Source§

impl UIFocusEnvironment for UIVisualEffectView

Available on crate features UIResponder and UIView and UIVisualEffectView only.
Source§

impl UIFocusEnvironment for UIWebView

Available on crate features UIResponder and UIView and UIWebView only.
Source§

impl UIFocusEnvironment for UIWindow

Available on crate features UIResponder and UIView and UIWindow only.