触发滑动操作后,我的自定义UITableViewCell
出现问题。我的单元格中有一个UIStepper
,UILabel
和一个UIImage
,但是当我滑动时,只有UIStepper
元素消失了。完成/取消滑动动作后,UIStepper
会在不久后重新出现。
请参阅随附的gif:
这是实现滑动操作的代码:
override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let deleteAction = UIContextualAction(style: .destructive, title: "Delete") { (action, view, handler) in
print("Delete Action Tapped")
}
let editAction = UIContextualAction(style: .destructive, title: "Edit") { (action, view, handler) in
print("Add Action Tapped")
}
editAction.backgroundColor = .orange
deleteAction.backgroundColor = .red
let configuration = UISwipeActionsConfiguration(actions: [deleteAction, editAction])
return configuration
}
在iOS 12上使用Swift 4.2和Xcode10。我们将不胜感激!