1. Custom transition animations There are a lot of code to write, and if the entire project transitions animation must be consistent, then you must consider encapsulating the modal code.
SECONDVC *second = [[SECONDVC alloc] init];
Second.modalpresentationstyle = Uimodalpresentationcustom;
Second.transitioningdelegate = Customizing an agent;
[Self Presentviewcontroller:second animated:yes completion:nil];
2. Customizing proxy objects
MYTransition.h
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Singleton.h"
@interface mytransition:nsobject<uiviewcontrollertransitioningdelegate>
Singletonh (mytransition)
@end
Mytransition.m
#import "MYTransition.h"
#import "MYPresentationController.h"
#import "MYAnimatedTransition.h"
#import "Uiview+mj.h"
@implementation Mytransition
Singletonm (mytransition)
#pragma mark-uiviewcontrollertransitioningdelegate
-(Uipresentationcontroller *) Presentationcontrollerforpresentedviewcontroller: (Uiviewcontroller *) presented Presentingviewcontroller: (Uiviewcontroller *) presenting Sourceviewcontroller: (Uiviewcontroller *) source
{
return [[Mypresentationcontroller alloc]initwithpresentedviewcontroller:presented Presentingviewcontroller: Presenting];
}
-(ID <UIViewControllerAnimatedTransitioning>) Animationcontrollerforpresentedcontroller: (Uiviewcontroller * ) presented Presentingcontroller: (Uiviewcontroller *) presenting Sourcecontroller: (Uiviewcontroller *) source
{
Myanimatedtransition *anima = [[Myanimatedtransition alloc]init];
Anima.show = YES;
Return anima;
}
-(ID <UIViewControllerAnimatedTransitioning>) Animationcontrollerfordismissedcontroller: (Uiviewcontroller * ) dismissed
{
Myanimatedtransition *anima = [[Myanimatedtransition alloc]init];
Anima.show = NO;
Return anima;
}
@end
3. Using the encapsulated modal animation, it's very simple.
SECONDVC *second = [[SECONDVC alloc] init];
Second.modalpresentationstyle = Uimodalpresentationcustom;
Second.transitioningdelegate = [Mytransition sharedmytransition];
[Self Presentviewcontroller:second animated:yes completion:nil];
IOS Package modal Animation code