3

2 つのビューがあります。1 つはボタンのみ (ビュー 1) で、もう 1 つは検索バー付きのテーブルビュー (画面 2) を含みます。ユーザーがビュー 1 でそのボタンをクリックすると、ビュー 1 が反転して画面 2 が表示されます。

ビュー 2 は、上部にナビゲーション バーがあるナビゲーション コントローラーの内部にあります。

以下は私が今のところ持っているものです。トランジション アニメーションが機能し、2 番目の画面に切り替わりますが、ビュー 2 には SearchBar と NavigationBar のタイトルがありません。どちらもビュー 2 内に設定されています。


[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];

navigationController = [[UINavigationController alloc] init];

bestbuyProducts = [[BestBuyProductsViewController alloc] initWithNibName:@"BestBuyProductsViewController" bundle:nil];  
[navigationController pushViewController:bestbuyProducts animated:NO];
[navigationController.view setFrame: [self.view bounds]];
[bestbuyProducts release];

[self.view addSubview:navigationController.view];

[UIView commitAnimations];

ありがとうございました

4

2 に答える 2

4

UINavigationController を起動するには、正しく初期化されていません。次のように initWithRootViewController: メソッドを使用します。

bestbuyProducts = [[BestBuyProductsViewController alloc] initWithNibName:@"BestBuyProductsViewController" bundle:nil];  

// Initialise the navigation view with the bestbuyProducts view controller
navigationController = [[UINavigationController alloc] initWithRootViewController:bestbuyProducts ];

次に、モーダル ビュー トランジションを使用してフリップ アニメーションを作成してみます。開始するのがより簡単で安全です。

[navigationController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:navigationController animated:YES];

[navigationController release];
[bestbuyProducts release];
于 2010-02-27T12:10:55.653 に答える
1

OK、これが正しいバージョンです


navigationController = [[UINavigationController alloc] initWithRootViewController:bestbuyProducts];
[bestbuyProducts setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:navigationController animated:YES];

于 2010-02-27T19:34:42.183 に答える