我的项目中有以下代码,
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView,
trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let emailAction = UIContextualAction(style: .normal,
title: "",
handler: { (_, _, success: (Bool) -> Void) in
// Some code
success(true)
})
emailAction.image = #imageLiteral(resourceName: "envelope")
let deleteAction = UIContextualAction(style: .normal,
title: "",
handler: { (_, _, success: (Bool) -> Void) in
// Some code
success(true)
})
deleteAction.image = #imageLiteral(resourceName: "trash")
return UISwipeActionsConfiguration(actions: [emailAction, deleteAction])
}
当我打开语音时崩溃了。在下面找到我得到的错误,
[UITableTextAccessibilityElement _accessibilityCustomActionNamesAndIdentifiers],/BuildRoot/Library/Caches/com.apple.xbs/Sources/AccessibilityFrameworks/AccessibilityFrameworks-2396.1.4/Source/UIAccessibility/NSObjectAccessibility.m:3249 ***断言故障>***由于未捕获的异常终止应用程序' NSInternalInconsistencyException',原因:' UIAccessibilityCustomAction必须有一个名称。'
答案 0 :(得分:0)
所以这就是我所做的,我让它发挥作用:
我确实重新创建了这个项目,但这次我使用的是Storyboards(我最后一次没有),我从Cocoapods导入了SwipeCellKit Library,我按照他们的文档和VoiceOver完美地删除了它们中的一个单元indexPath.row没有问题。