1

I am struck with a new problem, on presenting the destinationViewController using custom segue, during transition the source ViewController is changed to black screen, i need the screen to be as it is (my design).

UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController][screenshot][1]

CATransition* transition = [CATransition animation];
transition.duration = 0.1;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromRight; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom


[destinationController.view.layer addAnimation:transition forKey:kCATransition];
[sourceViewController presentViewController:destinationController animated:NO completion:nil];
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Rakii
  • 75
  • 1
  • 10

1 Answers1

2

I think you need to keep the context, try this:

    UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
    rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
    UIViewController *destinationController = (UIViewController*)[self destinationViewController]
    [sourceViewController presentViewController:destinationController animated:NO completion:nil];
diogo.appDev
  • 1,595
  • 5
  • 16
  • 30
  • Hi,i am struck while doing the reverse operation. i wanna go to the first screen back from the second screen with the same animation i discussed above but struck with "The first screen comes immediately and then then animation of the first screen slowly coming and overlaping". i just wanna animate the first screen over the second screen – Rakii May 31 '14 at 14:11
  • how are you doing that? – diogo.appDev Jun 02 '14 at 14:26
  • how can one do this in swift? – Serge Pedroza Jul 10 '15 at 17:04