【发布时间】:2019-04-21 08:49:32
【问题描述】:
当用户单击 tableviewcell 中的元素时,我想呈现一个新的 ViewController。然而,用于启动 VC 的标准代码在 tableview 单元格中甚至在帮助器类中都不起作用,因为 TVC 和帮助器类都不能呈现视图控制器。
这是帮助类中的代码。无论是放在 helperclass 还是 tableview 单元格中,它都没有启动 VC 的当前方法。
class launchVC {
func launchVCNamed(identifier: String) {
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let secondVC = storyBoard.instantiateViewController(withIdentifier: "contactDetail")
//FOLLOWING LINE HAS ERROR NO SUCH MEMBER (present)
self.present(secondVC, animated: true, completion: nil)
}
}
如何修改它以启动 VC?
【问题讨论】:
标签: ios swift presentviewcontroller