ios - -segueForUnwindingToViewController: fromViewController: identifier: not being called -


i have created custom segue presents view controller inside container similar apple's own modal view controllers (i've implemented uiviewcontroller subclass).

i'm trying create custom unwind segue there's no way can method -segueforunwindingtoviewcontroller: fromviewcontroller: identifier: called.

i've implemented -viewcontrollerforunwindsegueaction: fromviewcontroller: withsender: on container can point correct view controller (the 1 presented modal) method should asked custom unwind segue doesn't called anywhere.

right now, way me dismiss modal on -returned: method.

did custom unwind segue?


edit: little bit more code , context

my unwind view controller configured in storyboard, not programatically.

i have these pieces of code related unwind segues in controllers:

presenterviewcontroller.m

i'm using custom method dismiss custom modals here (-dismissmodalviewcontrollerwithcompletionblock:).

- (uistoryboardsegue *)segueforunwindingtoviewcontroller:(uiviewcontroller *)toviewcontroller                                       fromviewcontroller:(uiviewcontroller *)fromviewcontroller                                               identifier:(nsstring *)identifier {     return [[mymodalunwindsegue alloc] initwithidentifier:identifier                                                    source:fromviewcontroller                                               destination:toviewcontroller]; }  -(ibaction)returned:(uistoryboardsegue *)segue {     if ([segue.identifier isequaltostring:@"infounwindsegue"]) {         [self dismissmodalviewcontrollerwithcompletionblock:^{}];     } } 

mymodalviewcontroller.m

here use -viewcontrollerforunwindsegueaction: fromviewcontroller: withsender: point view controller should unwind to.

- (uiviewcontroller *)viewcontrollerforunwindsegueaction:(sel)action                                        fromviewcontroller:(uiviewcontroller *)fromviewcontroller                                                withsender:(id)sender {     return self.mypresentingviewcontroller; } 

the behavior expecting mymodalviewcontroller called point view controller should handle unwinding , view controller had -segueforunwindingtoviewcontroller: fromviewcontroller: identifier: method called before -returned: gets called.

right -segueforunwindingtoviewcontroller: fromviewcontroller: identifier: never gets called.

i must tried different configurations. everywhere put method return unwind segue never gets called. i've read can subclass navigation controller , gets called don't know how fit in solution.


edit 2: additional info

i've checked mymodalviewcontroller has -segueforunwindingtoviewcontroller: fromviewcontroller: identifier: method called when want dismiss regular modal view controller presented it. may because he's top uiviewcontroller in hierarchy.

after checking i've subclassed uinavigationcontroller , used subclass instead contain presenterviewcontroller. quite surprised notice -segueforunwindingtoviewcontroller: fromviewcontroller: identifier: method called well.

i believe view controllers serve containers have method called. that's makes little sense me not ones presenting other view controllers, children doing so.

it's not ok me create logic in subclass choose segue class use class has no knowledge of children did.

apple forums down moment no way support right now. if has more info on how works please help! guess lack of documentation indicator of how unstable still is.

to add answer @jeremy, got unwinding modal uiviewcontroller uiviewcontroller contained within uinavigationcontroller work (i.e how expected to) using following within uinavigationcontroller subclass.

// pass top-most uiviewcontroller on stack. - (uistoryboardsegue *)segueforunwindingtoviewcontroller:(uiviewcontroller *)              toviewcontroller fromviewcontroller:(uiviewcontroller *)              fromviewcontroller identifier:(nsstring *)identifier {    uiviewcontroller *controller = self.topviewcontroller;    return [controller segueforunwindingtoviewcontroller:toviewcontroller                                   fromviewcontroller:fromviewcontroller                                           identifier:identifier]; } 

.. , implementing segueforunwindingtoviewcontroller usual in actual viewcontroller inside uinavigationcontroller.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -