• Stars
    star
    157
  • Rank 238,399 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple transition animator which allows you to perform custom animation when presenting an UIViewController.

JVTransitionAnimator Version License Platform

JVTransitionAnimator is a simple helper framework which allows you to present your View Controllers in a pretty cool way, with the use of Transition Animations. Pretty easy to use and customizable.

Previews

• Custom Animations

screenshot-1

• Pre-defined Animations

screenshot-2

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

  • Now, just create a JVTransitionAnimator property.
- (JVTransitionAnimator *)transitionAnimator
{
    if(!_transitionAnimator)
    {
        _transitionAnimator = [[JVTransitionAnimator alloc] init];
    }

    return _transitionAnimator;
}
  • To enabled interactive transitions you do this, for example, in the viewDidAppear of your UIViewController. Also, we need to set our transition delegate.
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];

    // we need to tell our transition animator the current view controller & the new controller to be pushed
    self.transitionAnimator.fromViewController = self;
    self.transitionAnimator.toViewController = self.secondController;

    // enabling interactive transitions
    self.transitionAnimator.enabledInteractiveTransitions = YES;

    // also don't forget to tell the new UIViewController to be presented that we will be using our animator & choose the animation
    self.transitionAnimator.slideInOutAnimation = YES;
    self.secondController.transitioningDelegate = self.transitionAnimator;
}
  • Then, we can further setup and customize our Transition Animations.
// here is the trick if you want longer animations or set a delay or event not bouncing (known as dampling) at all
self.transitionAnimator.duration = 1.0f;
self.transitionAnimator.delay = 0.0f;
self.transitionAnimator.damping = 0.5f;
self.transitionAnimator.velocity = 0.9f;
  • Finally, to trigger transitions we just need to make a simple presentViewController function call.
// whenever you want to present the new view controller animated
[self presentViewController:self.secondController animated:YES completion:nil];

Requirements

Developed and tested using iOS11+.

Installation

JVTransitionAnimtor is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "JVTransitionAnimator"

Author & Support

Contact me if you find any bugs or potential room for improvements. Jorge Valbuena (@JV17), [email protected]. BTW! You are welcome to help in supporting this pod or making improvements to it.

License

JVTouchEventsWindow is available under the MIT license. See the LICENSE file for more info.