Code Monkey home page Code Monkey logo

chtransitionanimationcontroller's Introduction

CHTransitionAnimationController

Transition between view controllers using pre-built custom transitions

Getting Started:

  • Drag and drop the animation files into your project (found in the 'Transition Animations' folder).
  • In the view controller doing the presenting, create an instance of CHTransitionAnimationController. Make sure this class contains the appropriate imports (i.e. import "CHTransitionAnimationController.h").
  • In your current View Controller, you must adhere to the UIViewControllerTransitioningDelegate. Then set your current view controller as the delegate of the view controller your are presenting, like so:
MyNextViewController *viewController = [[MyNextViewController alloc] init]; //instance of your next view controller
viewController.transitioningDelegate = self;  //set transitioning delegate
[self presentViewController:viewController animated:YES completion:nil];  //present next view controller
  • Implement the UIViewControllerTransitioningDelegate methods. Set the animationType of the CHTransitionAnimationController and then return your CHTransitionAnimationController instance in the appropriate delegate methods, like so:
-(id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
	CHTransitionAnimationController *animationController = [CHTransitionAnimationController new];
  	animationController.animationType = CHTransitionAnimationTypeGrow;
  	animationController.animationDuration = 0.5; //optional - defaults to 0.25
	return animationController;
}

- (id <UIViewControllerInteractiveTransitioning>) interactionControllerForDismissal:(id<UIViewControllerAnimatedTransitioning>)animator
{
	CHTransitionAnimationController *animationController = [CHTransitionAnimationController new];
	 animationController.animationType = CHTransitionAnimationTypeShrink;
  	animationController.animationDuration = 0.5; //optional - defaults to 0.25
	return animationController;
}

NOTE: The current animation types include:

  • CHTransitionAnimationTypeGrow
  • CHTransitionAnimationTypeShrink
  • CHTransitionAnimationTypeFade
  • CHTransitionAnimationTypeGrowWithRotation
  • CHTransitionAnimationTypeShrinkWithRotation
  • CHTransitionAnimationTypeSlideInFromTop
  • CHTransitionAnimationTypeSlideInFromBottom
  • CHTransitionAnimationTypeSlideOutToLeft
  • CHTransitionAnimationTypeSlideOutToRight
  • CHTransitionAnimationTypeSlideOutToTop
  • CHTransitionAnimationTypeSlideOutToBottom

These will work for either presenting or dismissing a view controller. Other transition types will come as I continue to work on this project. If you have any animations you'd like to see, let me know!

####Optional Steps: You can set the animationDuration property of the CHTransitionAnimationController instance, but you don't have to. It will default to 0.25. The animationDuration property is just that, the duration for which the animation will take to complete.

chtransitionanimationcontroller's People

Watchers

James Cloos avatar  avatar

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.