I have tableview... 1 table showing a new modal window and when I press the button I want to dismiss the modal window and push to VC. My code only hide the modal view but no push is made.
@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)
})
}
You should create a protocol
protocol View1Delegate: class {
func dismissViewController(controller: UIViewController)
}
When you tap button on Register will call delegate back to TableView. TableViewController should implement:
func dismissViewController(controller: UIViewController) {
controller.dismissViewControllerAnimated(true) { () -> Void in
//Perform segue or push some view with your code
}
}
You can do anything in here. Push screen you want. Detail implement you can see my demo: Demo Push View in Swift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With