iOS-我可以在cell.textLabel.text上禁用辅助功能吗? [英] iOS - Can I disable accessibility on cell.textLabel.text?
问题描述
我有一个应用程序,其中包含一个带有单元格的视图,该单元格使用内置的cell.textLabel和cell.contentView中的自定义UITextField。
I have an app that contains a view with a cell that uses the built-in cell.textLabel and a custom UITextField in cell.contentView.
我正在使用Voiceover和可访问性,而所需的行为是,只要我在单元格中的任意位置点击,都会选择UITextField的可访问性元素。
I am working with Voiceover and accessibility and the desired behavior would be that whenever I tap anywhere in the cell, the accessibility element for the UITextField would be selected.
我实际上看到的行为是cell.textLabel可访问性标签正在接管。当我没有将cell.textLabel设置为任何值时,一切都会按预期进行。我也尝试过设置 isAccessibilityElement属性,但是没有运气:
The behavior that I am actually seeing is that the cell.textLabel accessibility labels are taking over. When I don't have cell.textLabel set to anything, everything works as expected. I have also attempted to set the "isAccessibilityElement" property with no luck:
[cell.textLabel.text setIsAccessibilityElement:NO];
有人知道如何以我想要的方式进行这项工作吗?
Does anyone know how to make this work the way I want?
推荐答案
我能够使用以下方法解决此问题:
cell.textLabel.accessibilityElementsHidden = YES;
I was able to figure this out using this:
cell.textLabel.accessibilityElementsHidden = YES;
这篇关于iOS-我可以在cell.textLabel.text上禁用辅助功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!