Skip to content

tamastimar/TTZoomTransition

Repository files navigation

TTZoomTransition

Travis Coveralls CocoaPods

TTZoomTransition is a custom modal view controller transition which displays the presented view controller by zoom animation.

TTZoomTransition in action

Installation

You can use TTZoomTransition via CocoaPods. Add the following line to your Podfile:

Podfile

pod TTZoomTransition

Usage

Set modalPresentationStyle property of your modal view controller to UIModalPresentationCustom. Also set the transitioningDelegate property.

ModalViewController* modalVC = [[ModalViewController alloc] init];
modalVC.modalPresentationStyle = UIModalPresentationCustom;
modalVC.transitioningDelegate = self;

[self presentViewController:modalVC animated:YES completion:nil];

In your transitioning delegate implement the following methods of UIViewControllerTransitioningDelegate:

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source
{
    TTZoomTranstition* zoomTransition = [[TTZoomTranstition alloc] init];
    return zoomTransition;
}

- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed
{
    TTZoomTranstition* zoomTransition = [[TTZoomTranstition alloc] init];
    zoomTransition.presenting = NO;
    return zoomTransition;
}

Demo

pod try TTZoomTransition

If you don't have CocoaPods on your machine, get it: [sudo] gem install cocoapods.

Requirements

  • iOS 9+

Contact

Tamás Tímár

License

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

Acknowledgements

Images in example are from Pixabay.

About

A simple custom modal view controller transition for iOS projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published