Type Method

accessibilityElementWithRole:frame:label:parent:

Instantiates and configures a new accessibility element.

Declaration

+ (id)accessibilityElementWithRole:(NSAccessibilityRole)role frame:(NSRect)frame label:(NSString *)label parent:(id)parent;

Parameters

role

The new element’s intended role. For a complete list of roles, see Roles.

frame

The element’s frame in screen coordinates. Additionally, you need to set the element’s accessibilityFrameInParentSpace property.

label

A short description of the new element. Do not include the element’s type in the label (for example, use Play, not Play button). If possible, use a single word. To help ensure that accessibility clients such as VoiceOver read the label with the correct intonation, start the label with a capital letter. Do not put a period at the end. Always localize the label.

parent

The new element’s parent in the accessibility hierarchy.

Return Value

A newly instantiated and initialized accessibility element.

Discussion

Alternatively, instead of calling this convenience method, you can create an accessibility element and set its accessibilityRole, accessibilityLabel, and accessibilityParent properties. Regardless of how you create the accessibility element, you need to set its accessibilityFrameInParentSpace property to ensure that the element’s frame is updated as its parent moves.

See Also

Supporting the Accessibility Hierarchy

- accessibilityAddChildElement:

Adds a child to the element in the accessibility hierarchy.

accessibilityFrameInParentSpace

Sets the element’s frame in its parent’s coordinate system.