The answers above rely on ObjC to fix the problem, I found a clean Swift solution. When I added a segue handler to Swift, I managed to create a spinning segment in Interface Builder (Xcode 6.3), the handler was not called.
@IBAction func unwindToParent(sender: UIStoryboardSegue) { dismissViewControllerAnimated(true, completion: nil) }
So after digging canPerformUnwindSegueAction:fromViewController:withSender from the superclass returns false . So I redefined the implementation and it works:
override func canPerformUnwindSegueAction(action: Selector, fromViewController: UIViewController, withSender sender: AnyObject) -> Bool { return action == Selector("unwindToParent:") }
Update
Invalid code since I solved the problem without overriding canPerformUnwindSegueAction:fromViewController:withSender . The main mistake was to distinguish between the viewcontroller view and the presented view manager.
When an untied session is initiated, it must first find the nearest view controller in the navigation hierarchy that implements the unwind action specified when the unwind session was created. This view controller becomes the decoupling point. If no suitable view controller is found, the unwinding segment is interrupted.
source: Technical Note TN2298
So, define @IBAction in the viewcontroller, and not on the presented view controller. Thus, segue will have meaningful values ββfor the destinationViewController and sourceViewController , being respectively the representing and represented view manager.
bouke Jun 18 '15 at 5:16 2015-06-18 05:16
source share