【发布时间】:2017-07-21 14:14:12
【问题描述】:
当在自定义单元格类型中点击按钮时,我正在尝试移动到新的故事板,但自定义类有问题。我目前有这个
class submitCell: UITableViewCell {
@IBAction func cancelButton(_ sender: Any) {
}
}
我需要取消按钮来执行此操作
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "TripList") as! TripTableViewController
self.present(viewController, animated: true , completion: nil) //Move
除了.present不是UITableViewCell的方法,只有UIViewController。我怎样才能实现这个功能?
【问题讨论】:
-
您真的不应该从 TableViewCell 执行此操作,因为它会破坏 MVC。您应该真正将操作委托给 tableViewController(或它的父视图控制器)。
标签: ios swift uitableview uibutton