0

OKay私はしばらくの間この問題に取り組んできました、そしてそれは私の専門知識をはるかに超えているので、なぜ私は再び助けを求めています。

タブバーボタンをクリックして別のビューに移動するアニメーションを作成しようとしています。私は両方のviewController(ViewWillAppear)メソッドで以下のコードを宣言しました

- (void)viewWillAppear:(BOOL)animated
{
    //TODO: Fix transition animation

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight
                           forView:self.view cache:YES];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView commitAnimations];

    [super viewWillAppear:animated];  
}

FirstViewControllerを右に、SecondViewControllerを左に。

これで、ユーザーがアプリを初めてロードしたときに問題が発生します。すべてがロードされ、ユーザーがタブバーボタンをクリックして2番目のビューに移動すると、反転しません。ただし、FirstViewに戻るとアニメーション化されます。次に、もう一度2番目に移動すると、今回はアニメーション化されます。これが発生している理由を誰かが知っている人はいますか?あなたがあなたの助けをするならば、大いに感謝されるでしょう!

更新::viewDidLoadにアニメーションを追加しようとしていますが、すぐにロードしているオープニングシーケンスのアニメーションがすでにあります。

[super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //-- Start Opening Animation ------->
    CGRect vaultTopFrame = vaultTop.frame;
    vaultTopFrame.origin.y = -vaultTopFrame.size.height;

    CGRect vaultBottomFrame = vaultBottom.frame;
    vaultBottomFrame.origin.y = self.view.bounds.size.height;

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:2.5];
    [UIView setAnimationDelay:2.0];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

    vaultTop.frame = vaultTopFrame;
    vaultBottom.frame = vaultBottomFrame;

    [self.view bringSubviewToFront:vaultTop];   //this should place this subview above any others on the same page
    [self.view bringSubviewToFront:vaultBottom]; //this should place this subview above any others on the same page

    [UIView  commitAnimations];

これは私にとって物事を台無しにするかもしれないと思いますあなたはどう思いますか?

4

2 に答える 2

0

アプリの読み込み時にアニメーションはありません。viewDidLoadビューがロードされたときにアニメーションをアニメーションに設定viewDidAppearし、ユーザーがワード後に遷移したときにアニメーションを提供します(タブがクリックされるたびに)。

于 2011-07-22T04:03:47.190 に答える
0

これは問題である場合とそうでない場合がありますが、電話する必要があります

[super viewWillAppear:animated];  

メソッドの最初、アニメーションコードの前。

于 2011-07-22T04:04:01.880 に答える