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
UIActionSheet
only.impl UIFocusEnvironment for UIActivityIndicatorView
UIActivityIndicatorView
only.impl UIFocusEnvironment for UIActivityViewController
UIActivityViewController
only.impl UIFocusEnvironment for UIAlertController
UIAlertController
only.impl UIFocusEnvironment for UIAlertView
UIAlertView
only.impl UIFocusEnvironment for UIButton
UIButton
only.impl UIFocusEnvironment for UICalendarView
UICalendarView
only.impl UIFocusEnvironment for UICloudSharingController
UICloudSharingController
only.impl UIFocusEnvironment for UICollectionReusableView
UICollectionViewCell
only.impl UIFocusEnvironment for UICollectionView
UICollectionView
only.impl UIFocusEnvironment for UICollectionViewCell
UICollectionViewCell
only.impl UIFocusEnvironment for UICollectionViewController
UICollectionViewController
only.impl UIFocusEnvironment for UICollectionViewListCell
UICollectionViewListCell
only.impl UIFocusEnvironment for UIColorPickerViewController
UIColorPickerViewController
only.impl UIFocusEnvironment for UIColorWell
UIColorWell
only.impl UIFocusEnvironment for UIControl
UIControl
only.impl UIFocusEnvironment for UIDatePicker
UIDatePicker
only.impl UIFocusEnvironment for UIDocumentBrowserViewController
UIDocumentBrowserViewController
only.impl UIFocusEnvironment for UIDocumentMenuViewController
UIDocumentMenuViewController
only.impl UIFocusEnvironment for UIDocumentPickerExtensionViewController
UIDocumentPickerExtensionViewController
only.impl UIFocusEnvironment for UIDocumentPickerViewController
UIDocumentPickerViewController
only.impl UIFocusEnvironment for UIDocumentViewController
UIDocumentViewController
only.impl UIFocusEnvironment for UIEventAttributionView
UIEventAttributionView
only.impl UIFocusEnvironment for UIFontPickerViewController
UIFontPickerViewController
only.impl UIFocusEnvironment for UIImagePickerController
UIImagePickerController
only.impl UIFocusEnvironment for UIImageView
UIImageView
only.impl UIFocusEnvironment for UIInputView
UIInputView
only.impl UIFocusEnvironment for UIInputViewController
UIInputViewController
only.impl UIFocusEnvironment for UILabel
UILabel
only.impl UIFocusEnvironment for UIListContentView
UIListContentConfiguration
only.impl UIFocusEnvironment for UIPageControl
UIPageControl
only.impl UIFocusEnvironment for UIPageViewController
UIPageViewController
only.impl UIFocusEnvironment for UIPasteControl
UIPasteControl
only.impl UIFocusEnvironment for UIPickerView
UIPickerView
only.impl UIFocusEnvironment for UIPopoverBackgroundView
UIPopoverBackgroundView
only.impl UIFocusEnvironment for UIPopoverPresentationController
UIPopoverPresentationController
only.impl UIFocusEnvironment for UIPresentationController
UIPresentationController
only.impl UIFocusEnvironment for UIProgressView
UIProgressView
only.impl UIFocusEnvironment for UIReferenceLibraryViewController
UIReferenceLibraryViewController
only.impl UIFocusEnvironment for UIRefreshControl
UIRefreshControl
only.impl UIFocusEnvironment for UIScrollView
UIScrollView
only.impl UIFocusEnvironment for UISearchBar
UISearchBar
only.impl UIFocusEnvironment for UISearchContainerViewController
UISearchContainerViewController
only.impl UIFocusEnvironment for UISearchController
UISearchController
only.impl UIFocusEnvironment for UISearchTextField
UISearchTextField
only.impl UIFocusEnvironment for UISegmentedControl
UISegmentedControl
only.impl UIFocusEnvironment for UISheetPresentationController
UISheetPresentationController
only.impl UIFocusEnvironment for UISlider
UISlider
only.impl UIFocusEnvironment for UISplitViewController
UISplitViewController
only.impl UIFocusEnvironment for UIStackView
UIStackView
only.impl UIFocusEnvironment for UIStandardTextCursorView
UIStandardTextCursorView
only.impl UIFocusEnvironment for UIStepper
UIStepper
only.impl UIFocusEnvironment for UISwitch
UISwitch
only.impl UIFocusEnvironment for UITabBar
UITabBar
only.impl UIFocusEnvironment for UITabBarController
UITabBarController
only.impl UIFocusEnvironment for UITableView
UITableView
only.impl UIFocusEnvironment for UITableViewCell
UITableViewCell
only.impl UIFocusEnvironment for UITableViewController
UITableViewController
only.impl UIFocusEnvironment for UITextField
UITextField
only.impl UIFocusEnvironment for UITextFormattingViewController
UITextFormattingViewController
only.impl UIFocusEnvironment for UITextView
UITextView
only.impl UIFocusEnvironment for UIToolbar
UIToolbar
only.impl UIFocusEnvironment for UIVideoEditorController
UIVideoEditorController
only.impl UIFocusEnvironment for UIView
UIView
only.impl UIFocusEnvironment for UIViewController
UIViewController
only.impl UIFocusEnvironment for UIVisualEffectView
UIVisualEffectView
only.impl UIFocusEnvironment for UIWebView
UIWebView
only.impl UIFocusEnvironment for UIWindow
UIWindow
only.