0

4 つのタブと 1 つにフックされたナビゲーション バーを備えたタブバー アプリケーションがあります。ナビゲーション バーのあるタブには、新しいページに移動するためのボタンがあります。タブページに戻るものもありますが、問題があります。タブページに戻ると、アニメーションがうまくいきません。これはすべてストーリーボードで行ったので、コーディングはありません。私は周りを見回して、これをコードに入れたい:

- (void) pushController: (UIViewController*) controller
     withTransition: (UIViewAnimationTransition) transition
{
[UIView beginAnimations:nil context:NULL];
[self pushViewController:controller animated:NO];
[UIView setAnimationDuration:.5];
[UIView setAnimationBeginsFromCurrentState:YES];        
[UIView setAnimationTransition:transition forView:self.view cache:YES];
[UIView commitAnimations];
}

しかし、私はそれをどこにどのように置くべきかわかりません。

4

1 に答える 1

0

カスタム セグエの作成に関するこのApple ガイドをご覧ください。実行コードは次のようになります。

- (void)perform {
    [UIView beginAnimations:nil context:NULL];
    [self.sourceViewController.navigationController pushViewController:self.destinationViewController animated:NO];
    [UIView setAnimationDuration:.5];
    [UIView setAnimationBeginsFromCurrentState:YES];        
    [UIView setAnimationTransition:transition forView:self.view cache:YES];
    [UIView commitAnimations];
}

次に、ストーリーボードで、セグエのタイプを [カスタム] に設定し、カスタム セグエ クラスの名前を入力します。

于 2013-07-26T02:29:42.147 に答える