Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Swift中的可访问性:TableView中的画外音返回空列表_Ios_Swift_Tableview_Accessibility_Voiceover - Fatal编程技术网

Ios Swift中的可访问性:TableView中的画外音返回空列表

Ios Swift中的可访问性:TableView中的画外音返回空列表,ios,swift,tableview,accessibility,voiceover,Ios,Swift,Tableview,Accessibility,Voiceover,我正在使用自定义单元格以编程方式创建表视图。但是,当我使用VoiceOver进行测试时,即使单元格中有值,我也会得到“空列表”和“内容为空”。有什么建议吗 我的桌面视图- func createTable(_ choicesArray:[String]){ myTableView = UITableView(frame: CGRect(x: 10, y: self.verticalPostion, width: 340, height: 300)) self.choices

我正在使用自定义单元格以编程方式创建表视图。但是,当我使用VoiceOver进行测试时,即使单元格中有值,我也会得到“空列表”和“内容为空”。有什么建议吗

我的桌面视图-

  func createTable(_ choicesArray:[String]){

    myTableView = UITableView(frame: CGRect(x: 10, y: self.verticalPostion, width: 340, height: 300))
    self.choicesData = choicesArray
    myTableView.estimatedRowHeight = 70
    myTableView.rowHeight = UITableViewAutomaticDimension
    myTableView.allowsMultipleSelection = true
    myTableView.register(AnswerCell.self, forCellReuseIdentifier: "cell")
    myTableView.dataSource = self
    myTableView.delegate = self

    myTableView.isAccessibilityElement = false
    myTableView.shouldGroupAccessibilityChildren = true

   // myTableView.reloadData()
    self.view.addSubview(myTableView)
}

 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

    let cell = tableView.cellForRow(at: indexPath)
   //more code for cell selection
}


func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return choicesData.count
}

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
    UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, tableView);
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! AnswerCell

     cell.choiceLabel.text = self.choicesData[indexPath.row]
    return cell
}
自定义单元格的代码-

class AnswerCell: UITableViewCell {

var choiceLabel = UILabel()

func configure(_ description: String) {
    choiceLabel.text = description
     applyAccessibility()
}

final func applyAccessibility() {
    isAccessibilityElement = true
    accessibilityLabel = choiceLabel.text!
    accessibilityHint = "Double tap to play."
    choiceLabel.isAccessibilityElement = false;
   }

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)
    self.contentView.addSubview(choiceLabel)
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
}

override func layoutSubviews() {
    super.layoutSubviews()

    choiceLabel.frame = CGRect(x: 20, y: 0, width: 70, height: 30)
}

}

试试myTableView.isAccessibilityElement=True也不能使用该选项。您在项目选择器列表中看到了什么?请尝试myTableView.isAccessibilityElement=True也不能使用该选项。您在项目选择器列表中看到了什么?