我创建了一个列表,其中我提供了一个用于编辑列表的详细信息披露按钮,但是当我点击这个按钮时它显示了一个错误
Could not cast value of type.
这是我的代码:
override func tableView(tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath)
{
let navigationController = storyboard!.instantiateViewControllerWithIdentifier("ListNavigationController") as! UINavigationController
let controller = navigationController.topViewController as! ListDetailViewController
controller.delegate = self
let checklist = dataModel.lists[indexPath.row]
controller.checklistToEdit = checklist
presentViewController(navigationController, animated: true, completion: nil)
}
最佳答案
我分析了您的项目并建议您删除所有不需要的导航 Controller 并将此代码添加到您的 accessoryButtonTappedForRowWithIndexPath
方法中:
let VC = storyboard!.instantiateViewControllerWithIdentifier("ListNavigationController") as! ListDetailViewController
self.navigationController?.pushViewController(VC, animated: true)
关于ios - 无法将类型 'to_do_list.AddItemViewController' (0x1009f3970) 的值转换为 'to_do_list.ListDetailViewController' (0x1009f3850),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31826728/