這不是你想要的確切代碼,但你能得到怎樣的方式做動畫你想
首先必須通過參數NO
任何動畫,而push和pop視圖,並不得不給一些自定義動畫喜歡這
// Flash the screen white and fade it out to give UI feedback that a still image was taken
UIView *flashView = [[UIView alloc] initWithFrame:[[self videoPreviewView] frame]];
[flashView setBackgroundColor:[UIColor whiteColor]];
[[[self view] window] addSubview:flashView];
[UIView animateWithDuration:.4f
animations:^{
[flashView setAlpha:0.f];
}
completion:^(BOOL finished){
[flashView removeFromSuperview];
}
];
對於更詳細的答案,使用有道塊看到this answer在其他問題上的SO
一些從答案的代碼是遵循
推送:
MainView *nextView = [[MainView alloc] init];
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[super pushViewController:nextView animated:NO];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO];
}];
對於POP:
[UIView animateWithDuration:0.75
animations:^{
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:transition forView:self.navigationController.view cache:NO];
}];
[self.navigationController popViewControllerAnimated:NO];
由於@ijordan
其他一些技巧的問題是here
This一個是你使用一個很好的例子,因爲沒有用它來做額外的編碼,因爲它提供了導航控制器動畫的類別。
參考這個答案鏈接這將幫助你http://stackoverflow.com/questions/2215672/how-to-change-the-push-and-pop-animations-in-a-navigation-based-app – user1548843