2

私は iPhone アプリケーションを開発しています。最初のビュー コントローラーをアニメーションでゆっくりと上に移動し、2 番目のビュー コントローラーに移動する必要があります。CoreAnimation を使用して、最初のビュー コントローラーをゆっくり上に移動し、次のビュー コントローラーにプッシュすることを考えています。これを達成するために利用できるクラス/ APIは何ですか?

ありがとうございました!

4

2 に答える 2

0

UIView複数のを使用して、単一のView Controllerでこれを簡単に実現できます

Appleのドキュメントによると:

iOS 4 以降では、ブロックベースのアニメーション メソッドを使用します。

したがって、意図した結果を生成するには、次のコードを使用します。

UIView *mySecondView = [[UIView alloc] initWithFrame:CGRectMake(0, 480, 320, 480)];
[mySecondView setBackgroundColor:[UIColor redColor]];
[self.view addSubview:mySecondView];

[UIView animateWithDuration:2.0 delay:3.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
    [mySecondView setTransform:CGAffineTransformMakeTranslation(0, -480)];
}completion:^(BOOL done){

}];
于 2012-08-25T09:09:04.113 に答える
0

これを試して、

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:yourfirstview cache:YES];
    [UIView setAnimationDidStopSelector:@selector(remove_view)];
    //change frame here
    yourfirstview.frame =CGRectMake(0,-480,320,480);
    [UIView commitAnimations];

   -(void)remove_view
    {
       [yourfirstview removeFromSuperview];
       [UIView beginAnimations:nil context:nil];
       [UIView setAnimationDuration:1.0];
       [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:yoursecondview cache:YES];
       //change frame here
       yoursecondview.frame =CGRectMake(0,0,320,480);
       [UIView commitAnimations];
    }
于 2012-08-25T07:36:29.303 に答える