views:

31

answers:

0

Hi I am writing an app in xcode 3.2.3. All I want to do is switch to another view but I am unsure of the best way to do this. I can do it either of these 2 ways...

PreferencesViewController *screen = [[PreferencesViewController alloc]initWithNibName:nil bundle:nil];

screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:screen animated:YES];

[screen release];

or using...

PreferencesViewController *screen = [[PreferencesViewController alloc]initWithNibName:nil bundle:nil];

[UIView beginAnimations:nil context:NULL];

[UIView setAnimationDuration:1.0];

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

[self.view addSubview:screen.view]; 

[UIView commitAnimations];

I have some problems with both of these methods. If I use presentModalViewController and I simulate a memory warning in the PreferencesViewController my app crashes. This is not the case with the second method. The second method however makes my buttons looks strange during the flipping animation.

Can someone tell me what is wrong and/or advise me on which method is right.

Thanks