使用iOS系统图标而不是文本滑动行的操作

时间:2017-10-11 10:53:03

标签: ios swift tableview swipe

我在iOS 11下设置了破坏性的拖尾动作:

@available(iOS 11.0, *)
  override func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

    let deleteAction = UIContextualAction(style: .destructive, title: "Delete", handler: { (action, view, completionHandler) in
      self.deleteRow(atIndexPath: indexPath)
      completionHandler(true)
    })

    // Is it possible here?
    //deleteAction.image = UIImage(named: "delete")

    let configuration = UISwipeActionsConfiguration(actions: [deleteAction])
    return configuration
  }

我想在这里找到Apple系统图标thrash bin,而不是“删除”文本: https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/system-icons/

显然,我可以从某个地方获取图标并将其设置为图像,但我想应该有一种原生方式来做到这一点。

感谢您的建议!

0 个答案:

没有答案