2010-05-31 57 views
4

我推我的視圖控制器用下面的語句:如何更改後退按鈕上的彈出視圖控制器動畫?

[[self navigationController] pushViewController:self.customViewController animatedWithTransition:UIViewAnimationTransitionFlipFromLeft]; 

現在,當我按下後退按鈕我想用uiviewanimationtransitionflipfromright動畫吧。

[self.navigationController popViewControllerAnimatedWithTransition:UIViewAnimationTransitionFlipFromLeft]; 

我該怎麼辦呢?

感謝

回答

5

這可以幫助你在動畫後退按鈕的視圖。

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
[UIView setAnimationDuration:0.75]; 
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations]; 

[UIView beginAnimations:nil context:NULL]; 
[UIView setAnimationDelay:0.375]; 
[self.navigationController popViewControllerAnimated:NO]; 
[UIView commitAnimations]; 
2

推送:

MainView *nextView = [[MainView alloc] init]; 
[UIView animateWithDuration:0.75 
        animations:^{ 
         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
         [self.navigationController pushViewController:nextView animated:NO]; 
         [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO]; 
        }]; 

對於POP:

[UIView animateWithDuration:0.75 
        animations:^{ 
         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; 
         [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:NO]; 
        }]; 
[self.navigationController popViewControllerAnimated:NO]; 

https://stackoverflow.com/a/5889757/1915820

相關問題