IOS: accessibility label for CALayer

I want to add accessibilityLabel for some of my CALayer. Here is an 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 does not work for me. Is it possible to make accessibility for CALayers?

I do not want to use the accessibility container in supervision (there is a complex hierarchy)

Thanks!

+4
source share
1 answer

AFAIK, a custom view built from CALayers, does not support accessibility, so I think the simple answer to your question will not be that way! You might want to check out Apple’s recommendations for creating accessibility for dynamic elements .

0
source

Source: https://habr.com/ru/post/1444387/


All Articles