iOS: Accessibility Label for CALayer

徘徊边缘 提交于 2019-12-30 20:27:11

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/13254122/ios-accessibility-label-for-calayer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!