I have a big application with many transitions in it using storyboard. The transitions should be from right to left so I made a custom segue to perform it.
When I use the regular transition, each view controller I push into the navigation stack is being retained until I pop it.
While using custom segues doesn't retain the previous controller (the one who push the current controller) and when I pop back, the instance of the controller gets a different memory address, which indicates that the pointer had changed.
This is the custom push segue:
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
CATransition* transition = [CATransition animation];
transition.duration = .3f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
[sourceViewController.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
and the custom pop segue:
UIViewController *sourceViewController = (UIViewController*)[self sourceViewController];
UIViewController *destinationController = (UIViewController*)[self destinationViewController];
CATransition* transition = [CATransition animation];
transition.duration = .3f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromRight;
[sourceViewController.navigationController.view.layer addAnimation:transition
forKey:kCATransition];
[sourceViewController.navigationController pushViewController:destinationController animated:NO];
I perform the the segue with this method:
[self performSegueWithIdentifier:@"SearchToMenu" sender:self];
Nothing seems to work and I haven't found anything online.
If I need to provide more code examples, screenshots, etc, please let me know.