Push segue in xcode without animation

I use a regular storyboard and press segues in xcode, but I want segues to just appear in the next view, and not slide in the next view (for example, when you use the tab bar and the next view appears).

Is there a simple easy way for a regular push segment to just β€œpop up” rather than β€œslide” without the need to add custom segments?

Everything works fine, I just want to remove this slide animation between the views.

+84
xcode animation segue
Apr 25 '13 at 7:47
source share
10 answers

Now I managed to do this using the following code:

CreditsViewController *creditspage = [self.storyboard instantiateViewControllerWithIdentifier:@"Credits"]; [UIView beginAnimations:@"flipping view" context:nil]; [UIView setAnimationDuration:0.75]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.navigationController.view cache:YES]; [self.navigationController pushViewController:creditspage animated:NO]; [UIView commitAnimations]; 

Hope this helps someone else!

+6
Apr 27 '13 at 13:35
source share

I was able to do this by creating a custom segue (based on this link ).

  • Create a new segue class (see below).
  • Open the storyboard and select Seg.
  • Define the PushNoAnimationSegue class (or whatever you decide to name).

Specify a segue class in Xcode

Swift 4

 import UIKit /* Move to the next screen without an animation. */ class PushNoAnimationSegue: UIStoryboardSegue { override func perform() { self.source.navigationController?.pushViewController(self.destination, animated: false) } } 

Goal c

PushNoAnimationSegue.h

 #import <UIKit/UIKit.h> /* Move to the next screen without an animation. */ @interface PushNoAnimationSegue : UIStoryboardSegue @end 

PushNoAnimationSegue.m

 #import "PushNoAnimationSegue.h" @implementation PushNoAnimationSegue - (void)perform { [self.sourceViewController.navigationController pushViewController:self.destinationViewController animated:NO]; } @end 
+136
Aug 29 '13 at 11:22
source share

You can uncheck "Animations" in "Interface-Builder" for iOS 9

enter image description here

+37
Oct 14 '15 at 2:39 on
source share

Answer Yang works great!

Here's the Swift version of Segue, if anyone needs to:

PushNoAnimationSegue.swift

 import UIKit /// Move to the next screen without an animation. class PushNoAnimationSegue: UIStoryboardSegue { override func perform() { let source = sourceViewController as UIViewController if let navigation = source.navigationController { navigation.pushViewController(destinationViewController as UIViewController, animated: false) } } } 
+35
Nov 01 '14 at 20:46
source share

Here the Swift version is adapted for the modally present ViewController without animation:

 import UIKit /// Present the next screen without an animation. class ModalNoAnimationSegue: UIStoryboardSegue { override func perform() { self.sourceViewController.presentViewController( self.destinationViewController as! UIViewController, animated: false, completion: nil) } } 
+3
May 10 '15 at 15:31
source share

For those using Xamarin iOS, your custom segue class should look like this:

 [Register ("PushNoAnimationSegue")] public class PushNoAnimationSegue : UIStoryboardSegue { public PushNoAnimationSegue(IntPtr handle) : base (handle) { } public override void Perform () { SourceViewController.NavigationController.PushViewController (DestinationViewController, false); } } 

Remember that you still need to set up a custom segment in your bulletin board and set the class to the PushNoAnimationSegue class.

+1
Aug 28 '15 at 14:19
source share

answer using Swift3 -

for "push" segue:

 class PushNoAnimationSegue: UIStoryboardSegue { override func perform() { source.navigationController?.pushViewController(destination, animated: false) } } 

for the "modal" segment:

 class ModalNoAnimationSegue: UIStoryboardSegue { override func perform() { self.source.present(destination, animated: false, completion: nil) } } 
+1
Jan 29 '17 at 9:30
source share

For me, the easiest way to do this is:

 UIView.performWithoutAnimation { self.performSegueWithIdentifier("yourSegueIdentifier", sender: nil) } 

Available with iOS 7.0

0
May 13 '16 at 16:00
source share

I am using Visual Studio w / Xamarin and the developer does not provide a checkmark "Animation" in the dtochetto answer.

Note that the Xcode constructor will apply the following attribute to the segue element in the .storyboard file: animates = "NO"

I manually edited the .storyboard file and added animates = "NO" to the segue element, and it worked for me.

Example:

  <segue id="1234" destination="ZB0-vP-ctU" kind="modal" modalTransitionStyle="crossDissolve" animates="NO" identifier="screen1ToScreen2"/> 
0
May 25 '17 at 10:38 pm
source share

Just set animated false to UINavigationController.pushViewController in Swift

 self.navigationController!.pushViewController(viewController, animated: false) 
-one
Dec 17 '15 at 18:58
source share



All Articles