0

ナビゲーション ベースのアプリケーションで backbarbuttonitem のフリップ アニメーションを使用するにはどうすればよいですか? ナビゲーション ベースのアプリケーションにフリップ アニメーションを追加したいだけです。

4

1 に答える 1

0

これを行うには、デフォルトの戻るボタンをカスタムの戻るボタンに置​​き換える必要があります。私の知る限り、矢印ナビゲーション ボタンはプライベート API にのみ存在するため、矢印ボタンにはなりません。

ボタンを作成するには、次のようにします。

UIBarButtonItem *customBackButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(flipPopView)];

self.navigationItem.leftBarButtonItem = customBackButton;

[customBackButton release];

flipPopView次に、実際にフリップ バックするメソッドを作成する必要があります。

- (void)flipPopView {

    // animateView should be whichever view you want the animation to occur in.
    UIView *animateView = self.navigationController.view;

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration: 0.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:animateView cache:YES];

    [self.navigationController popViewControllerAnimated:NO];

    [UIView commitAnimations];

}

これは、いくつかの同様のコードに基づいていますが、動作が異なる場合があります。問題がある場合はお知らせください。できることを確認します。

于 2011-06-21T21:01:29.190 に答える