View
5.635
Download
1
Category
Preview:
Citation preview
Custom TransitionShinichiro Yamashita
Custom Transition• iOS7から以下の遷移を自作することが可能
• UICollectionViewControllerのレイアウト変更
• UINavigationControllerのPush/Pop
• ModalViewのPresentation/Dismissal
• UITabBarControllerのタブ切り替え
1. UICollectionViewLayoutクラスのインスタンス、UICollectionViewControllerクラスのインスタンスを各々2つ以上用意
UICollectionViewLayout *cvl1,*cvl2,*cvl3; UICollectionViewController *cvc1, *cvc2, *cvc3; cvc1 = [cvc1 initWithCollectionViewLayout:cvl1]; ...
2. 遷移後のUICollectionViewControllerクラスのインスタンスのuseLayoutToLayoutNavigationTransitionsプロパティをYES
!!![nav pushViewController:cvc1 animated:YES]; cvc2.useLayoutToLayoutNavigationTransitions = YES; cvc3.useLayoutToLayoutNavigationTransitions = YES; [nav pushViewController:cvc2 animated:YES]; [nav pushViewController:cvc3 animated:YES]; [nav popViewControllerAnimated:YES];
3. 遷移指定はPushのみ
Layout-to-layout navigation transitions
UINavigationControllerの画面遷移
1. UINavigationControllerDelegateプロトコルの実装
@interface CCLFirstCollectionViewController : UICollectionViewController <UINavigationControllerDelegate> @end
2. UINavigationControllerDelegateメソッドを実装 !!
- (id<UIViewControllerAnimatedTransitioning>)navigationController: (UINavigationController *)navigationController animationControllerForOperation: (UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC { … }
3. UIViewControllerAnimatedTransitioningプロトコルを実装 !!
@interface CCLTransitionFromFirstToMoved : NSObject <UIViewControllerAnimatedTransitioning> !@end
DEMO
Recommended