这不是什么大问题,但我正面临两难选择。我正在实现一些 iOS UI 测试,但我无法将框架所需的辅助功能标识符设置到我的 UITableView。
整个部分似乎没有出现在界面构建器的身份检查器中。
请参阅附件中的屏幕截图。
我尝试以编程方式进行,但效果不佳。
我在 viewDidLoad() 中将可访问性标识符设置为已启用及其值
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view
// set delegate and data source
tableView.delegate = self;
tableView.dataSource = self;
// load the table Data
tableData = ["Red", "Green", "Blue", "White", "Yellow"]
// set accessibility identifier
tableView.isAccessibilityElement = true
tableView.accessibilityIdentifier = "tableView"
}
这只是一个示例应用程序,我正在其中测试实际框架。
欢迎任何帮助。
我正在使用 XCode 7.3.1
最佳答案
试试这个:
tableView.accessibilityLabel = "My tableView label"
tableView.isAccessibilityElement = true
有关 tableView
的 accessibility
的更多详细信息,请参阅:Enhance the Accessibility of UITableView
关于ios - 无法在 iOS 中为 UITableView 设置辅助功能标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38745412/