rso*_*son 12 iphone curl transition
UIViewAnimationTransitionCurlUp然而,我有一个工作过渡使用,我希望动画中途停止,就像地图应用程序...有关如何实现这一点的任何想法?
tJe*_*ner 11
在iOS 3.2或更高版本,你可以给你UIViewController一个UIModalTransitionStyle的UIModalTransitionStylePartialCurl.从UIViewController 参考文献中我们看到
typedef enum {
UIModalTransitionStyleCoverVertical = 0,
UIModalTransitionStyleFlipHorizontal,
UIModalTransitionStyleCrossDissolve,
UIModalTransitionStylePartialCurl,
} UIModalTransitionStyle;
Run Code Online (Sandbox Code Playgroud)
因此,一个示例用例将是:
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;
Run Code Online (Sandbox Code Playgroud)
我找到了一个使用Animation块将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];
;}
];
}
Run Code Online (Sandbox Code Playgroud)
当你想要隐藏这个视图时,你可以使用:
-(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];
;}
];
}
Run Code Online (Sandbox Code Playgroud)
我希望我能帮助你.
地图部分卷曲是私有 API。您可以在 Erica Sadun 的书The iPhone Developer's Cookbook中找到有关如何使用它的详细信息,但您将因使用它而被 App Store 拒绝。
| 归档时间: |
|
| 查看次数: |
7914 次 |
| 最近记录: |