NSObject(SLAccessibilityHierarchy) Category Reference
Declared in | NSObject+SLAccessibilityHierarchy.h |
Overview
The methods in the NSObject (SLAccessibilityHierarchy)
category
allow Subliminal and 3rd-party developers to examine the accessibility hierarchy
—a subset of the hierarchy formed by views and the accessibility elements
they vend.
3rd-party developers might use the methods in this category to determine
why an interface element is not accessible: see willAppearInAccessibilityHierarchy
.
3rd-party developers might use the methods in “Navigating the Accessibility Hierarchy” to develop predicates that match elements at particular positions in the accessibility hierarchy, as an alternative to setting accessibility identifiers, when no other accessibility information is available.
Tasks
Determining Whether An Element Will Appear In the Accessibility Hierarchy
-
– willAppearInAccessibilityHierarchy
Returns a Boolean value that indicates whether the receiver will appear in the accessibility hierarchy.
Navigating the Accessibility Hierarchy
-
– slAccessibilityParent
Returns the SLAccessibility-specific accessibility container of the receiver.
-
– slChildAccessibilityElementsFavoringSubviews:
Creates and returns an array of objects that are child accessibility elements of this object.
-
– slIndexOfChildAccessibilityElement:favoringSubviews:
Returns the index of the specified child element in the array of the child accessibility elements of the receiver.
-
– slChildAccessibilityElementAtIndex:favoringSubviews:
Returns the child accessibility element of the receiver at the specified index.
Instance Methods
slAccessibilityParent
Returns the SLAccessibility-specific accessibility container of the receiver.
- (NSObject *)slAccessibilityParent
Return Value
The object’s superview, if it is a UIView
;
otherwise its accessibilityContainer
, if it is a UIAccessibilityElement
;
otherwise nil
.
Discussion
This method allows the developer to navigate upwards through the hierarchy
constructed by slChildAccessibilityElementsFavoringSubviews:
. That hierarchy
is not guaranteed to contain only those elements that will appear in the
accessibility hierarchy.
See Also
Declared In
NSObject+SLAccessibilityHierarchy.h
slChildAccessibilityElementAtIndex:favoringSubviews:
Returns the child accessibility element of the receiver at the specified index.
- (NSObject *)slChildAccessibilityElementAtIndex:(NSUInteger)index favoringSubviews:(BOOL)favoringSubviews
Parameters
- index
The index of the child accessibility element to be returned.
- favoringSubviews
If
YES
, subviews should be ordered before accessibility elements among the receiver’s child accessibility elements; otherwise, they will be ordered afterwards.
Return Value
The child accessibility element at the specified index in the array of the child accessibility elements of the receiver.
Declared In
NSObject+SLAccessibilityHierarchy.h
slChildAccessibilityElementsFavoringSubviews:
Creates and returns an array of objects that are child accessibility elements of this object.
- (NSArray *)slChildAccessibilityElementsFavoringSubviews:(BOOL)favoringSubviews
Parameters
- favoringSubviews
If YES, views should be placed before accessibility elements in the returned array; otherwise, they will be placed afterwards.
Return Value
An array of objects that are child accessibility elements of this object.
Discussion
If the receiver is a UIView
, this will also include subviews.
This method, applied recursively, will construct a hierarchy that includes all accessibility elements and views of the receiver. This hierarchy is not guaranteed to contain only those elements that will appear in the accessibility hierarchy.
See Also
Declared In
NSObject+SLAccessibilityHierarchy.h
slIndexOfChildAccessibilityElement:favoringSubviews:
Returns the index of the specified child element in the array of the child accessibility elements of the receiver.
- (NSUInteger)slIndexOfChildAccessibilityElement:(NSObject *)childElement favoringSubviews:(BOOL)favoringSubviews
Parameters
- childElement
A child accessibility element of the receiver.
- favoringSubviews
If
YES
, subviews should be ordered before accessibility elements among the receiver’s child accessibility elements; otherwise, they will be ordered afterwards.
Return Value
The index of the child element in the array of child accessibility elements of the receiver.
Declared In
NSObject+SLAccessibilityHierarchy.h
willAppearInAccessibilityHierarchy
Returns a Boolean value that indicates whether the receiver will appear in the accessibility hierarchy.
- (BOOL)willAppearInAccessibilityHierarchy
Return Value
YES if the receiver will appear in the accessibility hierarchy, otherwise NO.
Discussion
The receiver will only be accessible to UIAutomation if it appears in the hierarchy. Experimentation reveals that presence in the hierarchy is determined by a combination of the receiver’s accessibility information and its location in the view hierarchy.
See the method’s implementation for specifics, or use the Accessibility Inspector: if it can read an element’s information, some underlying object is present in the accessibility hierarchy.
Declared In
NSObject+SLAccessibilityHierarchy.h