Shadowman
Shadowman

Reputation: 12049

Perform a segue with NO animation?

Is it possible to perform an iOS segue but with NO animation whatsoever? I haven't found any documentation indicating that it is, but I'd imagine that given the fact that there's an animated:(BOOL)animated property on practically every method in UIKit there must be some way to accomplish this.

We've got a simply UIViewController setup, and when the user presses a UIButton, I'd like to be able to perform the segue but with absolutely no animation. Our existing code looks like this:

func buttonPressed(sender: AnyObject?) {
   self.performSegue("MySegue", sender: nil)
}

I haven't been able to find any way of preventing the Segue from animating, though. Thoughts?

Upvotes: 8

Views: 7661

Answers (2)

derdida
derdida

Reputation: 14904

you could easily deactivate the Animation in your storyboard:

Sotyboard

Upvotes: 14

LS_
LS_

Reputation: 7129

On the button action add the following code:

TryViewController *trypage = [self.storyboard instantiateViewControllerWithIdentifier:@"Try"];
 [self.navigationController pushViewController:trypage animated:NO];

You just need to set the Storyboard ID of the view you want to go. Storyboard ID can be found here: enter image description here

Upvotes: 3

Related Questions