How can I do a "show (e.g Push)" segue programatically without animation? None of the solutions I've found works the same way as the one in storyboard.
What the show (e.g. Push)
segue does internally is to call
-[UIViewController showViewController:sender:]
Calling this method on your view controller itself, will trigger the appropriate way of presenting the view controller you are passing.
// Swift
self.showViewController(viewControllerToShow, sender: self)
// Objective-C
[self showViewController: viewControllerToShow sender: self];
The animation can be removed, by wrapping the call in an +[UIView performWithoutAnimation:] block.
// Swift
UIView.performWithoutAnimation {
self.showViewController(viewControllerToShow, sender: self)
}
// Objective-C
[UIView performWithoutAnimation:^void () {
[self showViewController: viewControllerToShow sender: self];
}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With