OGeek|极客世界-中国程序员成长平台

标题: ios - UIViewController View 的默认辅助功能标签 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 00:04
标题: ios - UIViewController View 的默认辅助功能标签

Apple 的 UIAccesibility 协议(protocol) reference状态:

UIAccessibilityLabel

Discussion

The default value for this property is nil unless the receiver is a UIKit control, in which case the value is a label derived from the control’s title.

嗯... UIView 和 UIViewController 都在 UIKit 框架中,但是我找不到由名为 LoginVC 的 UIViewController 控制的 View 的默认可访问性标签。我试图记录它,但得到一个空白字符串。那正确吗?医生错了吗?还是我做错了什么?

我知道我可以手动设置无障碍标签;我想避免困惑并尽可能使用默认值 - 如果它们的名称实际上是从它们的 Controller 派生的,那么它们通常已经是描述性的。



Best Answer-推荐答案


默认情况下,UIViewUIViewController 没有为它们的 title 属性设置任何内容,因此默认的 accessibilityLabel 属性(从 title 属性派生)正确并预期返回 nil。设置它们的 title 属性(在代码中或在 Interface Builder 中),您会在运行时记录 accessibilityLabel 时看到它。

关于ios - UIViewController View 的默认辅助功能标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13997739/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4