5

こんにちは、xcode 3.2.3 でアプリを作成しています。私がやりたいことは、別のビューに切り替えることだけですが、これを行う最善の方法がわかりません。この2つの方法のいずれかで実行できます...

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

screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:screen animated:YES];

[screen release];

または使用して...

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];

これらの方法の両方にいくつか問題があります。presentModalViewController を使用し、PreferencesViewController でメモリ警告をシミュレートすると、アプリがクラッシュします。これは、2 番目の方法には当てはまりません。ただし、2 番目の方法では、フリップ アニメーション中にボタンが奇妙に見えます。

誰かが何が間違っているか教えてくれますか、どの方法が正しいかアドバイスしてくれますか?

ありがとう

4

2 に答える 2

0

これを試すことができます。リリースすることを忘れないでください:

[self.navigationController pushViewController:[[YourViewController alloc]    initWithNibName:nil bundle:nil] animated:YES];   
于 2012-08-03T03:09:11.287 に答える
0

PresentModalViewController:-

YourViewController *vC = [YourViewController alloc]initWithNibName:@"YourViewController" bundle:nil];
vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:vC animated:YES];
[vC release];

これは私にとってはうまくいっています

このコードを試してください。

于 2013-05-13T12:54:23.420 に答える