我有 tableview...1 表显示一个新的模式窗口,当我按下按钮时,我想关闭模式窗口并推送到 VC。我的代码仅隐藏模式视图,但不进行推送。
@IBAction func registrationBtn(sender: AnyObject) {
let openNewVC = self.storyboard?.instantiateViewControllerWithIdentifier("registrationVcID") as! RegistrationVC
self.dismissViewControllerAnimated(false, completion: { () -> Void in
self.navigationController?.pushViewController(openNewVC, animated: true)
})
}
你应该创建一个协议
protocol View1Delegate: class {
func dismissViewController(controller: UIViewController)
}
当您点击 Register 上的按钮时,会将委托回调回 TableView。 TableViewController 应该实现:
func dismissViewController(controller: UIViewController) {
controller.dismissViewControllerAnimated(true) { () -> Void in
//Perform segue or push some view with your code
}
}
你可以在这里做任何事。推你想要的屏幕。详细实现可以看我的demo:Swift 中的演示推送视图 https://github.com/vienvu89/DemoPushView
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)