UINavigationController の pushViewController で回転しながら遷移させるメモ
画面遷移するのは、UIView.addSubView とか、色々ありますが、階層遷移で、
回転させようと思ったら、自分で animation を設定させないといけない。
<画面遷移の回転なんだから、NavigationController でやってくれたら良いのに なんて…(^^;
presentModalViewController での
nextViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:navigationController animated:YES];
Horizontal でのスタイルを、UINavigationController.pushViewController 遷移で
実行したい という事。
Animationは、UIView を使って。
通常の Navigation 遷移は、
// 次画面遷移 - (void) transitNextView { // 次画面定義 NextViewController *nextViewController = [[NextViewController alloc] init]; // 次画面遷移 [self.navigationController pushViewController:nextViewController animated:NO]; }
このpushViewでの遷移を、UIViewのAnimationを使って実行する
// 次画面遷移 - (void) transitNextView { // 次画面定義 NextViewController *nextViewController = [[NextViewController alloc] init]; // Animation定義開始 [UIView beginAnimations:nil context:NULL]; // Animationの速度設定:徐々に加速 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; // Animation実行時間:0.75秒 [UIView setAnimationDuration:0.75]; // 次画面遷移 [self.navigationController pushViewController:nextViewController animated:NO]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.navigationController.view cache:NO]; // Animation開始 [UIView commitAnimations]; }
いろんなサイト巡って、色々試して何日もかかった割に、ほぼパクリんちょで作りました…orz
これから さ!
【参考】
☆iOS transition animation for pushViewController
http://stackoverflow.com/questions/10820294/ios-transition-animation-for-pushviewcontroller
☆トランジション[1] UIViewを使ったもの
http://cocoadays.blogspot.jp/2010/09/uiview-1.html
☆UIView Class Reference
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html