Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Accessibility Label for CALayer

I want to add accessibilityLabel for some of my CALayer's. Here is the example:

CALayer *testLayer = [CALayer layer];
[self.view.layer addSublayer:testLayer];
testLayer.backgroundColor = [UIColor purpleColor].CGColor;
testLayer.isAccessibilityElement = YES;
testLayer.accessibilityLabel = @"Some text";
testLayer.frame = CGRectMake(0, 300, 100, 100);

This approach doesn't work for me. Is it possible to make accessibility working for CALayers?
I don't want to use accessibility container in superview (there is complex hierarchy)

Thank you!

like image 812
Division Avatar asked Nov 06 '12 15:11

Division


People also ask

What is accessibility label in iOS?

The label is a very short, localized string that identifies the accessibility element, but does not include the type of the control or view. For example, the label for a Save button is “Save,” not “Save button.” By default, standard UIKit controls and views have labels that derive from their titles.

What is accessibility label?

For a text input field, its accessible label would be a short description of the data the field collects. For a control that is a group of options, such as a drop-down menu or list of radio buttons or checkboxes, the group should have a label that describes the relationship of the options.

What is accessibility label in SwiftUI?

An element's Accessibility Label is the first string read by VoiceOver when landing on an accessible element. It's also the string used to activate a control in Voice Control. You should think of this as the name of the element. Set an accessibility label on your SwiftUI element using the modifier .

What is Accessibilityvalue?

A string that represents the current value of the accessibility element.


1 Answers

AFAIK, A custom view built from CALayers does not have support for accessibility so I guess simple answer to your question would be no! You might want to check Apple's guidelines to create Accessibility for Dynamic Elements.

like image 130
AlienMonkeyCoder Avatar answered Oct 21 '22 05:10

AlienMonkeyCoder