2011-10-09 87 views
0

我正在尝试切换视图,但我希望动画与视图抬起并像一张纸折叠以查看底下是什么。iPhone查看动画

任何教程或如何获得该视图动画的例子,如果它是一个动画,将不胜感激。

实际上,当您点击角落上的按钮时,地图应用使用的视图。

回答

2

像这样的东西应该工作:

MyViewController *myView = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; 
myView.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissModalViewControllerAnimated:)] autorelease]; 
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:myView]; 
navigation.modalTransitionStyle = UIModalTransitionStylePartialCurl; 
navigation.delegate = self; 
[self presentModalViewController:navigation animated:YES]; 

这里的关键是在呈现模态视图之前,需要将10个属性设置为UIModalTransitionStylePartialCurl

此处了解详情:UIViewController Class Reference(找modalPresentationStylemodalTransitionStylepresentModalViewController:animated:dismissModalViewControllerAnimated:)。

+0

+1 - 不错的样本。 – bryanmac

1

这样做有两种基本方式,旧的是不再推荐:

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:0.5]; 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown 
            forView:containerView cache:YES]; 

[containerView addSubview:subview]; 

[UIView commitAnimations]; 

,而新的(它使用从iOS 4的支持和块):

[UIView transitionWithView:containerView duration:0.5 
    options:UIViewAnimationOptionTransitionCurlDown 
    animations:^ { [containerView addSubview:subview]; } 
    completion:nil]; 
+0

虽然这可能在理论上回答这个问题,但[这将是更可取的](http://meta.stackexchange.com/q/8259)在这里包含答案的重要部分,并提供供参考的链接。 –

+0

“转到本页面(可以改变,或完全消失,只要有第三方感觉)”不是答案。总结/释义在这里。 – cHao

+0

@ B蜥蜴你完全正确,编辑即将到来。 –