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 { ... }
}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§
Sourceunsafe fn preferredFocusEnvironments(
&self,
) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>
unsafe fn preferredFocusEnvironments( &self, ) -> Retained<NSArray<ProtocolObject<dyn UIFocusEnvironment>>>
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’.
Sourceunsafe fn parentFocusEnvironment(
&self,
) -> Option<Retained<ProtocolObject<dyn UIFocusEnvironment>>>
unsafe fn parentFocusEnvironment( &self, ) -> Option<Retained<ProtocolObject<dyn UIFocusEnvironment>>>
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.
Sourceunsafe fn focusItemContainer(
&self,
) -> Option<Retained<ProtocolObject<dyn UIFocusItemContainer>>>
unsafe fn focusItemContainer( &self, ) -> Option<Retained<ProtocolObject<dyn UIFocusItemContainer>>>
The container of any child focus items in this focus environment, or nil if no container exists.
Sourceunsafe fn setNeedsFocusUpdate(&self)
unsafe fn setNeedsFocusUpdate(&self)
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];
Sourceunsafe fn updateFocusIfNeeded(&self)
unsafe fn updateFocusIfNeeded(&self)
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];.
Sourceunsafe fn shouldUpdateFocusInContext(
&self,
context: &UIFocusUpdateContext,
) -> bool
unsafe fn shouldUpdateFocusInContext( &self, context: &UIFocusUpdateContext, ) -> bool
Asks whether the system should allow a focus update to occur.
Sourceunsafe fn didUpdateFocusInContext_withAnimationCoordinator(
&self,
context: &UIFocusUpdateContext,
coordinator: &UIFocusAnimationCoordinator,
)
Available on crate feature UIFocusAnimationCoordinator only.
unsafe fn didUpdateFocusInContext_withAnimationCoordinator( &self, context: &UIFocusUpdateContext, coordinator: &UIFocusAnimationCoordinator, )
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.
Sourceunsafe fn soundIdentifierForFocusUpdateInContext(
&self,
context: &UIFocusUpdateContext,
) -> Option<Retained<UIFocusSoundIdentifier>>
unsafe fn soundIdentifierForFocusUpdateInContext( &self, context: &UIFocusUpdateContext, ) -> Option<Retained<UIFocusSoundIdentifier>>
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.
unsafe fn preferredFocusedView(&self) -> Option<Retained<UIView>>
UIResponder and UIView only.Trait Implementations§
Source§impl ProtocolType for dyn UIFocusEnvironment
impl ProtocolType for dyn UIFocusEnvironment
impl<T> ImplementedBy<T> for dyn UIFocusEnvironment
Implementations on Foreign Types§
impl<T> UIFocusEnvironment for ProtocolObject<T>where
T: ?Sized + UIFocusEnvironment,
Implementors§
impl UIFocusEnvironment for UIActionSheet
UIResponder and UIView and UIActionSheet only.impl UIFocusEnvironment for UIActivityIndicatorView
UIResponder and UIView and UIActivityIndicatorView only.impl UIFocusEnvironment for UIActivityViewController
UIResponder and UIViewController and UIActivityViewController only.impl UIFocusEnvironment for UIAlertController
UIResponder and UIViewController and UIAlertController only.impl UIFocusEnvironment for UIAlertView
UIResponder and UIView and UIAlertView only.impl UIFocusEnvironment for UIButton
UIControl and UIResponder and UIView and UIButton only.impl UIFocusEnvironment for UICalendarView
UIResponder and UIView and UICalendarView only.impl UIFocusEnvironment for UICloudSharingController
UIResponder and UIViewController and UICloudSharingController only.impl UIFocusEnvironment for UICollectionReusableView
UIResponder and UIView and UICollectionViewCell only.impl UIFocusEnvironment for UICollectionView
UIResponder and UIScrollView and UIView and UICollectionView only.impl UIFocusEnvironment for UICollectionViewCell
UIResponder and UIView and UICollectionViewCell only.impl UIFocusEnvironment for UICollectionViewController
UIResponder and UIViewController and UICollectionViewController only.impl UIFocusEnvironment for UICollectionViewListCell
UICollectionViewCell and UIResponder and UIView and UICollectionViewListCell only.impl UIFocusEnvironment for UIColorPickerViewController
UIResponder and UIViewController and UIColorPickerViewController only.impl UIFocusEnvironment for UIColorWell
UIControl and UIResponder and UIView and UIColorWell only.impl UIFocusEnvironment for UIControl
UIResponder and UIView and UIControl only.impl UIFocusEnvironment for UIDatePicker
UIControl and UIResponder and UIView and UIDatePicker only.impl UIFocusEnvironment for UIDocumentBrowserViewController
UIResponder and UIViewController and UIDocumentBrowserViewController only.impl UIFocusEnvironment for UIDocumentMenuViewController
UIResponder and UIViewController and UIDocumentMenuViewController only.impl UIFocusEnvironment for UIDocumentPickerExtensionViewController
UIResponder and UIViewController and UIDocumentPickerExtensionViewController only.impl UIFocusEnvironment for UIDocumentPickerViewController
UIResponder and UIViewController and UIDocumentPickerViewController only.impl UIFocusEnvironment for UIDocumentViewController
UIResponder and UIViewController and UIDocumentViewController only.impl UIFocusEnvironment for UIEventAttributionView
UIResponder and UIView and UIEventAttributionView only.impl UIFocusEnvironment for UIFontPickerViewController
UIResponder and UIViewController and UIFontPickerViewController only.impl UIFocusEnvironment for UIImagePickerController
UINavigationController and UIResponder and UIViewController and UIImagePickerController only.impl UIFocusEnvironment for UIImageView
UIResponder and UIView and UIImageView only.impl UIFocusEnvironment for UIInputView
UIResponder and UIView and UIInputView only.impl UIFocusEnvironment for UIInputViewController
UIResponder and UIViewController and UIInputViewController only.impl UIFocusEnvironment for UILabel
UIResponder and UIView and UILabel only.impl UIFocusEnvironment for UIListContentView
UIResponder and UIView and UIListContentConfiguration only.impl UIFocusEnvironment for UIPageControl
UIControl and UIResponder and UIView and UIPageControl only.impl UIFocusEnvironment for UIPageViewController
UIResponder and UIViewController and UIPageViewController only.impl UIFocusEnvironment for UIPasteControl
UIControl and UIResponder and UIView and UIPasteControl only.impl UIFocusEnvironment for UIPickerView
UIResponder and UIView and UIPickerView only.impl UIFocusEnvironment for UIPopoverBackgroundView
UIResponder and UIView and UIPopoverBackgroundView only.impl UIFocusEnvironment for UIPopoverPresentationController
UIPresentationController and UIPopoverPresentationController only.impl UIFocusEnvironment for UIPresentationController
UIPresentationController only.impl UIFocusEnvironment for UIProgressView
UIResponder and UIView and UIProgressView only.impl UIFocusEnvironment for UIReferenceLibraryViewController
UIResponder and UIViewController and UIReferenceLibraryViewController only.impl UIFocusEnvironment for UIRefreshControl
UIControl and UIResponder and UIView and UIRefreshControl only.impl UIFocusEnvironment for UIScrollView
UIResponder and UIView and UIScrollView only.impl UIFocusEnvironment for UISearchBar
UIResponder and UIView and UISearchBar only.impl UIFocusEnvironment for UISearchContainerViewController
UIResponder and UIViewController and UISearchContainerViewController only.impl UIFocusEnvironment for UISearchController
UIResponder and UIViewController and UISearchController only.impl UIFocusEnvironment for UISearchTextField
UIControl and UIResponder and UITextField and UIView and UISearchTextField only.impl UIFocusEnvironment for UISegmentedControl
UIControl and UIResponder and UIView and UISegmentedControl only.impl UIFocusEnvironment for UISheetPresentationController
UIPresentationController and UISheetPresentationController only.impl UIFocusEnvironment for UISlider
UIControl and UIResponder and UIView and UISlider only.impl UIFocusEnvironment for UISplitViewController
UIResponder and UIViewController and UISplitViewController only.impl UIFocusEnvironment for UIStackView
UIResponder and UIView and UIStackView only.impl UIFocusEnvironment for UIStandardTextCursorView
UIResponder and UIView and UIStandardTextCursorView only.impl UIFocusEnvironment for UIStepper
UIControl and UIResponder and UIView and UIStepper only.impl UIFocusEnvironment for UISwitch
UIControl and UIResponder and UIView and UISwitch only.impl UIFocusEnvironment for UITabBar
UIResponder and UIView and UITabBar only.impl UIFocusEnvironment for UITabBarController
UIResponder and UIViewController and UITabBarController only.impl UIFocusEnvironment for UITableView
UIResponder and UIScrollView and UIView and UITableView only.impl UIFocusEnvironment for UITableViewCell
UIResponder and UIView and UITableViewCell only.impl UIFocusEnvironment for UITableViewController
UIResponder and UIViewController and UITableViewController only.impl UIFocusEnvironment for UITextField
UIControl and UIResponder and UIView and UITextField only.impl UIFocusEnvironment for UITextFormattingViewController
UIResponder and UIViewController and UITextFormattingViewController only.impl UIFocusEnvironment for UITextView
UIResponder and UIScrollView and UIView and UITextView only.impl UIFocusEnvironment for UIToolbar
UIResponder and UIView and UIToolbar only.impl UIFocusEnvironment for UIVideoEditorController
UINavigationController and UIResponder and UIViewController and UIVideoEditorController only.impl UIFocusEnvironment for UIView
UIResponder and UIView only.impl UIFocusEnvironment for UIViewController
UIResponder and UIViewController only.impl UIFocusEnvironment for UIVisualEffectView
UIResponder and UIView and UIVisualEffectView only.impl UIFocusEnvironment for UIWebView
UIResponder and UIView and UIWebView only.impl UIFocusEnvironment for UIWindow
UIResponder and UIView and UIWindow only.