2012-05-06 142 views
0

我想要在我的应用程序内进行转换,就像从旧史酷比动画片的神秘旋转墙。我希望屏幕在切换视图时旋转。任何人都指出我有正确的方向来完成这项工作的可能性?寻找应用程序内部转换(旋转屏幕效果)

+0

真我我只是在Big Nerd Ranch家伙的IOS编程指南中学习应用程序开发的开始。期待看到我是否能够在现有框架内实现我的应用创意。 –

+0

非常酷,它现在已经内置到XCODE中,现在我已经回来玩更多的IOS –

回答

0

我认为这是你在找什么:

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0]; 

//optional if you want to do something after the animation 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector:@selector(myAnimationDidFinish:finished:context:)]; 
// 

[view2 setFrame:CGRectMake(0, 0, view2.frame.size.width, view2.frame.size.height)]; 
[view1 addSubview:view2]; 

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:view1 cache:YES]; 
[UIView commitAnimations]; 

而且再翻回:

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0]; 

//optional if you want to do something after the animation 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector:@selector(myOtherAnimationDidFinish:finished:context:)]; 
// 

[view2 removeFromSuperview]; 

[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:view1 cache:YES]; 
[UIView commitAnimations]; 
+0

非常感谢帮助的人。我刚刚开始,但如果我可以学习如何做这件事,我有一些疯狂的想法。 –

+0

没问题。请务必接受您使用的最佳答案,并提出任何有用答案。您将对未来的问题获得更多答复。 – Joel

2

还是这个,它采用远不如墨:

UIView *bookCaseView; // this is the container... the haunted wall 
UIView *booksView;  // just an ordinary set of books, right? 
UIView *spookyBackside; // ruh-roh, raggy! 

[UIView transitionWithView:containerView 
      duration:0.2 
      options:UIViewAnimationOptionTransitionFlipFromLeft 
      animations:^{ 
       [booksView removeFromSuperview]; 
       [bookCaseView addSubview:spookyBackside]; } 
      completion:NULL]; 
+0

爱史酷比评论:P –

+0

不错。 +1。我的代码来自前置块项目。尽管对于代表1的代表而言,块可能有点高级! – Joel

+0

:-)有一点点学习曲线,但是很大的回报,imo。 – danh