Latest 0.0.1
Homepage https://github.com/lazutkin-andrey/ios-modal-transition
License MIT
Platforms ios 7.0, requires ARC
Frameworks Foundation, UIKit

The example of iOS Transition animation for Modal ViewController.

alt tag

–°ompatibility

iOS 7.0+

Installation

Using CocoaPods:

pod 'ios-modal-transition', '~> 0.0.1'

Usage

First step, you should implement UIViewControllerTransitioningDelegate protocol:


#import <ios-modal-transition/ALModalTrasition.h>

// This method will be called before presentation of modal window
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented
                                                                  presentingController:(UIViewController *)presenting
                                                                      sourceController:(UIViewController *)source {

return [[ALModalTrasition alloc]initShowWithBackgroundColor:[UIColor blackColor]
                                            backgroundAlpha:0.9
                                                 edgeInsets:UIEdgeInsetsMake(20, 10, 10, 10)
                                          animationDuration:0.3];
}

// This method will be called before close of modal window
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {

return [[ALModalTrasition alloc]initHideWithAnimationDuration:0.3];

}

Implement the modal presentation:

// Get View Controller from the Storyboard
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"
                                                         bundle: nil];

UIViewController *viewController = (UIViewController *)[mainStoryboard instantiateViewControllerWithIdentifier:@"modalViewController"];

// Change modal presentation style
viewController.modalPresentationStyle = UIModalPresentationCustom;

// Set delegate to class, where you've implemented UIViewControllerTransitioningDelegate protocol
viewController.transitioningDelegate = self;

// Show modal view
[self presentViewController:viewController animated:YES completion:nil];

License

MIT

Latest podspec

{
    "name": "ios-modal-transition",
    "version": "0.0.1",
    "summary": "Simple custom iOS Transition animation for Modal ViewController.",
    "description": "This is the simple custom iOS Transition animation for Modal ViewController",
    "homepage": "https://github.com/lazutkin-andrey/ios-modal-transition",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Andrey Lazutkin",
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/lazutkin-andrey/ios-modal-transition.git",
        "tag": "0.0.1"
    },
    "source_files": "ios-modal-transition-example/Classes/*.{h,m}",
    "public_header_files": "ios-modal-transition-example/Classes/*.h",
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This