0

ナビゲーションコントローラーのアニメーションを、新しいビューをビューにスライドさせるだけでなく、新しいビューをスライドさせるときに現在のビューをスライドさせるようなものに変更できるかどうか悩んでいます...

私はここにこの機能を持っています。それは私のスワイプを検出し、通常のナビゲーションコントローラーが行うようにビューをアニメーション化するだけです。しかし、私はあなたの助けを借りて何か他のものを理解できることを望んでいます。

// Need to change this to work with viewArray
- (void)swipedScreen:(UISwipeGestureRecognizer*)gesture {

    //Left swipe
    if (gesture.direction == UISwipeGestureRecognizerDirectionLeft) 
    {
        if (viewCount == 0) 
        {     
            viewCount += 1;
            // Load a detial view into the (sub)NavController
            DetailViewControllerA *detailViewA = [[DetailViewControllerA alloc] initWithNibName:@"DetailViewControllerA" bundle:[NSBundle mainBundle]];
            [otherNav pushViewController:detailViewA animated:YES];
        }
    }
    //Right swipe
    else if (gesture.direction == UISwipeGestureRecognizerDirectionRight)
    {
        if (viewCount == 1) 
        {
            viewCount -= 1;
            [self.otherNav popViewControllerAnimated:YES]; 
        }
    }  
}
4

1 に答える 1

1

これは、1 つの点滅する UIView を表示するために使用するこのような uiView アニメーション ブロックで行うことができます

[UIView animateWithDuration:1.0 
                          delay:0.0 
                        options:UIViewAnimationCurveEaseInOut 
                     animations:^ {
                         self.splash.alpha = 0.2;
                     } 
                     completion:^(BOOL finished) {
                         [UIView animateWithDuration:1.0 animations:^{
                             self.splash.alpha = 1.0;
                         }];
                     }];

また

以下のコードを使用して

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.window cache:YES];
    [UIView setAnimationDuration:0.75];
    [UIView setAnimationDelegate:self];
    [self.splash removeFromSuperview];
    [UIView commitAnimations];

フリップトランジション用

プッシュ/ポップアニメーションを変更するには、このコードを使用します

    [UIView  beginAnimations:nil context:NULL];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationDuration:0.75];
    [self.navigationController pushViewController:self.detailViewController animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];

コーディングをお楽しみください :)

ハッピーコッディング:)

于 2012-06-01T09:38:22.173 に答える