PDaria
PDaria

Reputation: 457

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!

Upvotes: 6

Views: 1677

Answers (1)

Paresh Masani
Paresh Masani

Reputation: 7504

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.

Upvotes: 1

Related Questions