ios - segueForUnwindingToViewController throws excpetion for incorrect parent view controller -
i'm trying run custom segue unwind transition. there overall navigation controller, , 2 subviews (viewa
, viewb
). trying go between these following code (triggered via button , storyboard reverse segue):
// xxxnavigationcontroller.h - (uistoryboardsegue *)segueforunwindingtoviewcontroller:(uiviewcontroller *) toviewcontroller fromviewcontroller:(uiviewcontroller *) fromviewcontroller identifier:(nsstring *)identifier { uiviewcontroller *controller = self.topviewcontroller; return [controller segueforunwindingtoviewcontroller:toviewcontroller fromviewcontroller:fromviewcontroller identifier:identifier]; } // xxxviewbcontroller.h (in reverse segue, going viewb -> viewa) - (uistoryboardsegue *) segueforunwindingtoviewcontroller:(uiviewcontroller *)toviewcontroller fromviewcontroller:(uiviewcontroller *)fromviewcontroller identifier:(nsstring *)identifier { xxxreversezoomsegue *segue = [[xxxreversezoomsegue alloc] initwithidentifier:identifier source:fromviewcontroller destination:toviewcontroller]; return segue; }
this results in following exception:
*** terminating app due uncaught exception 'uiviewcontrollerhierarchyinconsistency', reason: 'child view controller:<xxxviewacontroller: 0x14c5119e0> should have parent view controller:<xxxviewbcontroller: 0x15000b400> actual parent is:<xxxnavigationcontroller: 0x14c5116a0>'
how can set correctly can make reverse segue work?
Comments
Post a Comment