TeaCupApp
TeaCupApp

Reputation: 11452

How to change speed of segue between ViewControllers

Is it possible to control segue speed?

I have checked the documentation but there is no given method by Apple.

But I am more looking for ideas to hack in and change lower level code to make segueing in slow motion.

Upvotes: 3

Views: 2172

Answers (2)

Vitali K
Vitali K

Reputation: 136

to prevent zombies creation i think better to do use subview add/remove as well:

- (void)perform
{
    UIView *src = ((UIViewController *) self.sourceViewController).view;
    UIView *dst = ((UIViewController *) self.destinationViewController).view;

    UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
    [window insertSubview:dst aboveSubview:src];

    [UIView transitionFromView:src
                        toView:dst
                      duration:1.5
                       options:UIViewAnimationOptionTransitionCrossDissolve
                    completion:^(BOOL finished){
                        [src removeFromSuperview];
                        window.rootViewController = self.destinationViewController;
                    }];
}

this is if you are not using navigation controller!

Upvotes: 0

Feel Physics
Feel Physics

Reputation: 2783

Below code is of custom segue, and you can set duration of transition in code.

- (void)perform 
{
    UIViewController *src = (UIViewController *) self.sourceViewController;
    UIViewController *dst = (UIViewController *) self.destinationViewController;
    [UIView transitionFromView:src.view
                        toView:dst.view
                      duration:3.0
                       options:UIViewAnimationOptionTransitionFlipFromLeft
                    completion:NULL];

}

Sample project is here in GitHub:https://github.com/weed/p120805_CustomSegue

You can download and just run it. I wish this is help for you.

Upvotes: 5

Related Questions