presentViewController transition animation

Subramanian Raj picture Subramanian Raj · Mar 29, 2015 · Viewed 23k times · Source

In my code I am using presentViewController to call my second viewcontroller

[self presentViewController:secondController animated:YES completion:nil];

When I call I need to show left to right animation (like in navigationController)

I don't want to use the navigationController but I need the animation similar to navigationController in presentViewController...

Answer

Ch0k0l8 picture Ch0k0l8 · Mar 29, 2015

Add this line of code before presenting view controller

secondController.modalTransitionStyle   = UIModalTransitionStyleCrossDissolve;
secondController.modalPresentationStyle = UIModalPresentationFullScreen;

// Take a look at this enum

typedef enum {
   UIModalTransitionStyleCoverVertical = 0,
   UIModalTransitionStyleFlipHorizontal,
   UIModalTransitionStyleCrossDissolve,
   UIModalTransitionStylePartialCurl,
} UIModalTransitionStyle;