【发布时间】:2018-12-18 02:09:22
【问题描述】:
最近我添加了以下代码,以便在点击编辑按钮时显示一些用户输入的数据。但应用程序没有打开编辑视图控制器,而是冻结了。
override func tableView(_ tableView: UITableView,
leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration?
{
let modifyAction = UIContextualAction(style: .normal, title: "Edit", handler: { (ac:UIContextualAction, view:UIView, success:(Bool) -> Void) in
print("Update action ...")
let MainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let vc = MainStoryboard.instantiateViewController(withIdentifier: "FreshReleaseEdit") as! EditfreshreleaseViewController
vc.selectedFreshRelease = self.freshreleases[indexPath.row]
self.present(vc, animated: true, completion: nil)
success(true)
})
modifyAction.title = "Edit"
modifyAction.backgroundColor = .blue
return UISwipeActionsConfiguration(actions: [modifyAction])
}
当我点击编辑按钮时,应用程序崩溃并显示以下错误消息:
更新操作 ... 无法将“UINavigationController”(0x1d37e81e0)类型的值转换为“fresh_release.EditfreshreleaseViewController”(0x1043d7248)。 2018-12-17 20:56:30.547305-0500 新版本 [7644:1985252] 无法将“UINavigationController”(0x1d37e81e0)类型的值转换为“fresh_release.EditfreshreleaseViewController”(0x1043d7248)。 (lldb)
关于如何解决此问题的任何建议?
【问题讨论】:
标签: swift uiviewcontroller uinavigationcontroller edit