iOS:CALayer的辅助功能标签 [英] iOS: Accessibility Label for CALayer

查看:90
本文介绍了iOS:CALayer的辅助功能标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的一些CALayer添加accessibilityLabel。
例如:

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);

这种方法对我不起作用。

我不想在superview中使用可访问性容器(层次结构复杂)

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)

谢谢您!

推荐答案

AFAIK,根据CALayers构建的自定义视图不支持可访问性,所以我想对您的问题的简单回答会不行!您可能要检查苹果公司创建动态元素可访问性的指南

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.

这篇关于iOS:CALayer的辅助功能标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆