tags:

views:

88

answers:

2

I am looking for a way to animate a view transition when using the following code to switch between views:

BuildCard2ViewController *aViewController = [[BuildCard2ViewController alloc] initWithNibName:@"BuildCard2" bundle:nil];

self.view = [aViewController view];

I don't have a navigation controller in the application to manage the cool transitions, looking for a way to fit into the above.

Thanks in advance!

+1  A: 

Start with the Animating Views section of the iPhone Application Programming Guide. View transitions have good sample code in ViewTransitions.

You're also leaking the view controller above. Since the view controller manages the view, you're going to need to hold it in an ivar for the lifespan of the view so you can release it when you're done with the view.

Rob Napier
Thank you, reading this helped quite a bit. I ended up using a navigation controller in my tab, then push/pop the windows.
Rob Bonner
A: 

If you're drilling down and changing views often, a UINavigationController is probably the best way to go.

If BuildCard2 is only temporarily on the screen, use:

BuildCard2ViewController *aViewController = [[BuildCard2ViewController alloc] initWithNibName:@"BuildCard2" bundle:nil];

[self presentModalViewcontroller:aViewController animated:YES];

If you look at the documentation, or the Utility App template, you can specify which modal view animation to use.

Beware: when using a modalViewController, set 'self' as the delegate and implement some kind of callback technique, so you can call [self dismissModalViewController] when it's finished.

Boz