Custom Segue need to inherit the Uistoryboardsegue class, and then override the -(void) perform; method. You can customize the transition animation in the method.
</pre><span style= "Color:rgb (97, 34, 174); Font-family:courier; font-size:18px; " >coolsegue.h file </span><p></p><p></p><pre code_snippet_id= "420043" snippet_ File_name= "blog_20140707_2_5708153" name= "code" class= "OBJC" > #import <UIKit/UIKit.h> @interface coolsegue: Uistoryboardsegue@end
COOLSEGUE.M file
#import "CoolSegue.h" @implementation coolsegue-(void) perform{uiviewcontroller* Source = Self.sourceviewcontroller; uiviewcontroller* destination = Self.destinationviewcontroller; Uigraphicsbeginimagecontext (destination.view.bounds.size); Cgcontextref contextref = Uigraphicsgetcurrentcontext (); [Destination.view.layer Renderincontext:contextref]; uiimage* desimage = Uigraphicsgetimagefromcurrentimagecontext (); Uigraphicsendimagecontext (); uiimageview* IView = [[Uiimageview alloc] initwithimage:desimage]; [IView Setbackgroundcolor:[uicolor Graycolor]; Iview.autoresizingmask = uiviewautoresizingflexiblewidth| Uiviewautoresizingflexibleheight; Iview.contentmode = Uiviewcontentmodecenter; [Source.parentViewController.view Addsubview:iview]; Cgaffinetransform Scalet = Cgaffinetransformmakescale (0.1, 0.1); Cgaffinetransform rotatet = cgaffinetransformmakerotation (M_PI); Iview.transform = Cgaffinetransformconcat (Scalet, rotatet); Iview.transfoRM =cgaffinetransformtranslate (Cgaffinetransformconcat (Scalet, Rotatet), 1, 1); Cgpoint originpoint = Iview.center; Iview.center = Cgpointmake (IView.bounds.size.width, iView.bounds.size.height); Iview.center = Cgpointmake (Originpoint.x-iview.bounds.size.width, ORIGINPOINT.Y); [UIView animatekeyframeswithduration:0.8 delay:0 Options:uiviewkeyframeanimationoptioncalculationmodecubic animations:^{iview.transform = cgaffinetransformidentity; Iview.center = Originpoint; }completion:^ (BOOL finished) {[Self.sourceviewcontroller PresentViewController:self.destinationViewController Anim Ated:yes Completion:nil]; [IView Removefromsuperview]; }];}