12

但是我有一个工作过渡UIViewAnimationTransitionCurlUp,我希望动画中途停止,就像地图应用程序一样......关于如何实现这一点的任何想法?

4

4 回答 4

11

在 iOS 3.2 及更高版本中,您可以为您UIViewControllerUIModalTransitionStyle. 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

我找到了使用动画块将 UIView 添加到 UIViewController 的解决方案。

m_Container 是一个包含我的视图动画(自我)的 UIView。自我是一个 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 回答
1

Maps 部分 curl 是一个私有 API。你可以在 Erica Sadun 的书The iPhone Developer's Cookbook中找到如何使用它的详细信息,但你会因为使用它而被 App Store 拒绝。

于 2009-11-05T20:20:59.867 回答
0

不确定这是否可行,但参数 to+setAnimationRepeatCount:可以是一个分数。

于 2009-11-05T20:02:56.883 回答