【问题标题】:Unable to set Accessibility Identifier for UITableView in iOS无法在 iOS 中为 UITableView 设置辅助功能标识符
【发布时间】:2016-08-03 22:18:57
【问题描述】:

不是一个大问题,但是我面临着两难境地。我正在实施一些 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

【问题讨论】:

    标签: ios swift accessibility


    【解决方案1】:

    试试这个:

        tableView.accessibilityLabel = "My tableView label"
        tableView.isAccessibilityElement = true
    

    有关accessibilitytableView 的更多详细信息,请参阅此:Enhance the Accessibility of UITableView

    【讨论】:

      【解决方案2】:

      不是标识符,设置accessibilityLabel,框架通常使用那个

      【讨论】:

      • 感谢大家的意见,但也没找到accessibilityLabel。我尝试查看应用程序对象的 debugDescription
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多