简体   繁体   English

iOS 可访问性:使 UITextField 和指定的子视图可访问

[英]iOS Accessibility: make UITextField and specified subview accessible

I want to make a textfield and a subview on the text field accessible by VoiceOver.我想在 VoiceOver 可访问的文本字段上创建一个文本字段和一个子视图。 If I use UIAccessibilityContainer methods, I can only make the subviews accessible.如果我使用UIAccessibilityContainer方法,我只能使子视图可访问。 Is there some way to do this?有没有办法做到这一点?

No .没有 You must go up one level in the accessibility hierarchy.您必须在可访问性层次结构中上一层。 Implement the container protocol on your view's superview and return all of its descendants as children (and, thus, siblings of each other).在视图的父视图上实现容器协议,并将其所有后代作为子视图(因此,彼此的兄弟姐妹)返回。

try this,尝试这个,

textfield.isAccessibilityElement = YES; textfield.isAccessibilityElement = 是;

textfield.accessibilityElementsHidden = NO; textfield.accessibilityElementsHidden = 否;

Leave the container methods for time being.暂时离开容器方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM