首页 > 解决方案 > 让编辑按钮到我需要的地方

问题描述

我一直在尝试获取 FreshReleaseTableViewController 上的编辑按钮,以简单地将用户带回 AddFreshReleaseViewController。

任何建议,将不胜感激。

以下是我拥有的编辑按钮代码:

@available(iOS 11.0, *)
override func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
    let modifyAction = UIContextualAction(style: .normal, title:  "Update", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
        print("Update action ...")
        success(true)
    })
    modifyAction.title = "Edit"
    modifyAction.backgroundColor = .blue

    return UISwipeActionsConfiguration(actions: [modifyAction])
}

标签: swiftuitableviewuiviewcontrolleredit

解决方案


推荐阅读