ViewController view after another

I have an image picker that is collecting data for another view controller (TTMessageController from three20), and I want this message composer to appear behind the image picker, so when the image slider exits, the already appeared message controller with pre-filled data appears.

Code like this

[self.navigationController presentModalViewController:composeController animated:NO];
[picker dismissModalViewControllerAnimated:YES];

      

and, conversely, do not work at all. What to do? How to present composeController

behind the already presented controller picker

?

Thanks in advance.

+2


source to share


4 answers


Edit:

Ok, I think the problem here is in the modal bit, since the iPhone doesn't really look like you have 2 views set to modal or even animated from one modal view to another.

Should they be trendy? How do I add them to the normal navigation stack?

You can first add the message view to the stack (not animated) so that it is there when you return it.

Try the following:

The order in which you add views to the stack affects the order in which they are displayed when you dismiss them.



This part adds the composeController to the stack and then animates the collector coming from the top. Use this code to display the select controller (i.e. instead of a modal dialog):

[self.navigationController pushViewController:composeController animated:NO];
[self.navigationController pushViewController:picker animated:YES];

      

Then, when you're done with the composer, you can "put" the view back into the message composer:

[self.navigationController popViewControllerAnimated:YES];

      

Now you have no links to any modal dialogs left in your code. I believe this should work much better than a modal, which is really for displaying one view above each other, not going from view to view.

Hope it helps!

0


source


Actually removing animation from the viewController help.

[picker dismissModalViewControllerAnimated:NO];
[self presentModalViewController:composeNavController animated:NO]; // If YES it crashes

      



But this is not an iPhone-ish if you get what I mean, even fade black or just the visual effect makes it look much, much nicer. Technically it works.

0


source


Instead of trying to present another viewController behind the collector, you can dismiss the modal image viewer, press the message controller (both with animated: NO), and then use CATransition to perform your own Cocoa-like image animator animations from the screen.

0


source


You need to break these animations so they don't run in the same runloop. I ran into a situation where the OS doesn't like to reject and present modal views back.

Try the following:

- (void)myCallbackMethod{

[picker dismissModalViewControllerAnimated:YES];
[self performSelector:@selector(presentMessage) withObject:nil afterDelay:0.25];


}

- (void)presentMessage{

[self.navigationController presentModalViewController:composeController animated:YES];

}

      

0


source







All Articles