我有一个使用UIViewAnimationTransitionCurlUp
的工作过渡效果,但我希望动画在中途停止,就像地图应用程序一样...有没有想法如何实现这一点?
我有一个使用UIViewAnimationTransitionCurlUp
的工作过渡效果,但我希望动画在中途停止,就像地图应用程序一样...有没有想法如何实现这一点?
UIViewController
设置UIModalTransitionStylePartialCurl
的UIModalTransitionStyle
。从UIViewController
参考文献中可以看到。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;
-(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];
;}
];
}
Maps partial curl是一个私有API。您可以在Erica Sadun的书The iPhone Developer's Cookbook中找到如何使用它的详细信息,但如果使用它,您将被App Store拒绝。
不确定这是否有效,但是+setAnimationRepeatCount:
的参数可以是一个分数。