Is it possible in iOS 6 to know when a UIStoryboardSegue has finished its transition? Like when i add a UIStoryboardSegue from UIButton
In Swift, from a UIViewController subclass you can get the UINavigationController instance and set the delegate, in order to be informed about the completion of segues, as shown. Another logical place to track segues might be the AppDelegate.
Example of doing it from a view controller (VC for short):
class MyViewControllerSubclass : UIViewController, UINavigationControllerDelegate {
func viewDidLoad() {
self.navigationController.delegate = self
}
func navigationController(navigationController: UINavigationController, didShowViewController viewController: UIViewController, animated: Bool) {
println("Did show VC: \(viewController)")
}
}
But that only shows you when the segue to the VC is complete,
as would viewWillAppear() or viewDidAppear() delegate methods in the VC being presented; however, they don't inform about when the target VC is un-presented. It will also only work if your View Controller is part of a Navigation Controller stack.
In the VC you're tracking, you could add the following to detect when the VC (and its memory) are deallocated, or override the viewWillDisappear() method.
deinit {
println(__FUNCTION__, "\(self)")
}