Git Product home page Git Product logo

Comments (4)

enriquez avatar enriquez commented on July 17, 2024

I have not needed to use a navigation controller as an underLeftViewController. Have you or anyone figured this out?

from ecslidingviewcontroller.

DrBeak1 avatar DrBeak1 commented on July 17, 2024

One solution I've found is to present modally and just mimic the push transition. I found this code somewhere, I cannot find the source, it's been a while -- otherwise I'd credit the person who originally wrote it:

#import <UIKit/UIKit.h>

@interface UIViewController(Transitions)

  • (void) presentModalViewController:(UIViewController *)modalViewController withPushDirection: (NSString *) direction;
  • (void) dismissModalViewControllerWithPushDirection:(NSString *) direction;

@EnD

#import "UIViewController+Transitions.h"
#import <QuartzCore/QuartzCore.h>

@implementation UIViewController(Transitions)

  • (void) presentModalViewController:(UIViewController *)modalViewController withPushDirection: (NSString *) direction {

    [CATransaction begin];

    CATransition *transition = [CATransition animation];
    transition.type = kCATransitionPush;
    transition.subtype = direction;
    transition.duration = 0.25f;
    transition.fillMode = kCAFillModeForwards;
    transition.removedOnCompletion = YES;

    [[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"];
    [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
    [CATransaction setCompletionBlock: ^ {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ {
    [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    });
    }];

    [self presentModalViewController:modalViewController animated:NO];

    [CATransaction commit];

}

  • (void) dismissModalViewControllerWithPushDirection:(NSString *) direction {

    [CATransaction begin];

    CATransition *transition = [CATransition animation];
    transition.type = kCATransitionPush;
    transition.subtype = direction;
    transition.duration = 0.25f;
    transition.fillMode = kCAFillModeForwards;
    transition.removedOnCompletion = YES;

    [[UIApplication sharedApplication].keyWindow.layer addAnimation:transition forKey:@"transition"];
    [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
    [CATransaction setCompletionBlock: ^ {
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(transition.duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^ {
    [[UIApplication sharedApplication] endIgnoringInteractionEvents];
    });
    }];

    [self dismissModalViewControllerAnimated:NO];

    [CATransaction commit];

}

@EnD

from ecslidingviewcontroller.

MrBendel avatar MrBendel commented on July 17, 2024

See issue #59

from ecslidingviewcontroller.

enriquez avatar enriquez commented on July 17, 2024

c29ec93

from ecslidingviewcontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.