题
我有一个工作过渡 UIViewAnimationTransitionCurlUp
但是,我希望动画在中途停止,就像地图应用程序一样……关于如何实现这一目标的任何想法?
解决方案
地图部分卷发是私人API。您可以在Erica Sadun的书中找到如何使用它的详细信息 iPhone开发人员的食谱, ,但是您将被App Store拒绝使用它。
其他提示
在iOS 3.2及以后,您可以给您 UIViewController
一个 UIModalTransitionStyle
的 UIModalTransitionStylePartialCurl
. 。来自 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;
我找到了使用动画块向UiviewController添加Uiview的解决方案。
m_container是一个包含我的视图动画(self)的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];
;}
];
}
不确定这是否会起作用,但是参数 +setAnimationRepeatCount:
可以是一小部分。
不隶属于 StackOverflow