I am using xcode 6. I have a 'Cancel' button in my storyboard, when I click it, I want to dismiss my view controller and go back to where I come from. So in my storyboard, I wire the cancel button to my View Controller with 'Touch up' to my 'handleCancel' method.
When I touch the button, I see 'handleCancel' is being called. I see the debug printfs I put it. But it does not dismiss my current view controller.
@IBAction func handleCancel(sender: AnyObject) {
println("Calling handle Cancel")
self.dismissViewControllerAnimated(false, completion: nil)
}
Can you please tell me what else I am missing?
Thank you.
What is the current controller class? UIViewController? UINavigationController? Etc. What was the class of the presenting controller? Finally, what kind of segue did you use? Check the connections inspector in storyboard if unsure. There will be different techniques based on these answers.
For example, if this is a push segue in a UINavigationController you would pop the view with:
self.navigationController?.popViewControllerAnimated(true)
Any ways, let us know.
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