[iOS] performSegueWithIdentifier doesn’t trigger dismissViewControllerAnimated

My setup is as follows: I have three view controller scenes in my Storyboard and the workflow of the app is going from A -> B -> C. From scene C back to A there is an unwind segue set up in Storyboard. The latter I trigger from the view controller of C programmatically via

[self performSegueWithIdentifier:@"unwindFromCtoA" sender:self];

For the transition from B -> C I’m using a custom (“drop down”) animation with the UIViewControllerAnimatedTransitioning protocol. When unwinding from C -> A I want the inverse of that animation.

This all worked perfectly fine until I updated my iPhone 5 to iOS 8.0.2 (from iOS 7). Now, the (inverse) animation is not triggered anymore when unwinding form C -> A. Instead, it doesn’t show any animation, it just shows immediately view A.

While trying to find the source of the problem I replaced performSegueWithIdentifier from above with

[self dismissViewControllerAnimated:YES completion:nil];

and then it does show the correct animation. But clearly I don’t unwind to A in that case. This shows that there is nothing wrong with the animation. It merely seems that performSegueWithIdentifier doesn’t trigger dismissViewControllerAnimated as it did in iOS 7.


解法:

you’ll need to use:

[self.navigationController popViewControllerAnimated:YES];

to pop the view off the stack. There’s one segue call, but the framework seems to call:

presentViewController:animated:completion:

or:

pushViewController:animated:

from:
http://stackoverflow.com/questions/10274979/how-dismiss-a-viewcontroller-with-storyboard-from-a-push-segue

相關文章

寫留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *