12

私は動作中のトランジションを使用していUIViewAnimationTransitionCurlUpますが、マップ アプリケーションのように、アニメーションを途中で停止したいと考えています...これを達成する方法について何か考えはありますか?

4

4 に答える 4

11

UIViewControlleriOS 3.2 以降では、 のaUIModalTransitionStyleを指定できますUIModalTransitionStylePartialCurlUIViewController 参照から、

typedef enum {
  UIModalTransitionStyleCoverVertical = 0,
  UIModalTransitionStyleFlipHorizontal,
  UIModalTransitionStyleCrossDissolve,
  UIModalTransitionStylePartialCurl,
} UIModalTransitionStyle;

したがって、使用例は次のようになります。

UIViewController *viewController;
// …create or retrieve your view controller…

// Note: The modalPresentationStyle must be UIModalPresentationFullScreen,
//       and the presenter must also be a full-screen view
viewController.modalPresentationStyle = UIModalPresentationFullScreen;
viewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
于 2011-03-18T00:57:42.230 に答える
7

Animationブロックを使用してUIViewをUIViewControllerに追加するソリューションを見つけました。

m_Containerは、私のビューアニメーション(自己)を含むUIViewです。selfはUIViewです。

注意:QuartzCoreをインポートする必要があります

ページカールアニメーションでビューを表示するには、次を使用できます。

-(void)PresentView
{
    [UIView animateWithDuration:1.0 
                     animations:^{
                         CATransition *animation = [CATransition animation];
                         [animation setDelegate:self];
                         [animation setDuration:0.7];
                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
                         animation.type = @"pageCurl";
                         animation.fillMode = kCAFillModeForwards;
                         animation.endProgress = 0.65;
                         [animation setRemovedOnCompletion:NO];
                         [m_container.layer addAnimation:animation forKey:@"pageCurlAnimation"];  
                         [m_container addSubview:self];
                         ;}  
     ];    
}

そして、このビューを非表示にする場合は、次を使用できます。

-(void)HideHelpView
{
    [UIView animateWithDuration:1.0 
                     animations:^{
                         CATransition *animation = [CATransition animation];
                         [animation setDelegate:self];
                         [animation setDuration:0.7];
                         [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
                         animation.type = @"pageUnCurl";
                         animation.fillMode = kCAFillModeForwards;
                         animation.startProgress = 0.35;
                         [animation setRemovedOnCompletion:NO];
                         [m_container.layer addAnimation:animation forKey:@"pageUnCurlAnimation"];  
                         [self removeFromSuperview];

                         ;}  
     ];

}
于 2011-11-04T11:27:42.403 に答える