IPad: presentModalViewController creates a stack stack. Manipulate this stack (move cards from the middle of the deck?)

iPad: presentModalViewController creates a stack stack. Can you manipulate this stack (move cards from the middle of the deck?)

  [self presentModalViewController: navigationController1 animated: NO];
 [self presentModalViewController: navigationController2 animated: NO];
 [self presentModalViewController: navigationController3 animated: NO];

The above code creates a stack of three depths. "navigationController3" is displayed, and if it is rejected using "[self rejectModalViewController]", then navigationController2 is displayed.

While THREE is visible, I want to shift TWO from the middle of the stack / deck, so that when disconnected, THREE ONE is visible.

+4
source share
2 answers

According to the Apple doc here , the stack is a kind of double-list. It looks like this:

self.modalViewcontroller --> navigationController1 navigationController1.modalViewController --> navigationController2 navigationController2.modalViewController --> navigationController3 

and

  navigationController1.parentViewcontroller--> self navigationController2.parentViewcontroller--> navigationController1 navigationController3.parentViewcontroller--> navigationController2 

The problem is that you cannot communicate with these properties as they are read-only. The only solution I see is to reject navigationController2 when navigationcontroller3 is rejected.
For example, try this in your navigationController3 class:

 -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; self.parentviewcontroller. //navigationController2 parentviewcontroller. //navigationController1 dismissModalViewControllerAnimated:NO]; } 
+1
source

The quick fix is ​​to set up a notification. Call the method in navigationController3 that sends the notification that navigationController2 received that calls [self rejectModalViewController]. You can do the same with protocol / delegate callbacks.

0
source

All Articles