2012-05-06 143 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