Skip to content

stanfy/SFTransitionManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SFTransitionManager

Custom animation transition manager inspired by iOSCustomTransitions

Install

Using CocoaPods

pod 'SFTransitionManager', :git => 'https://github.com/stanfy/SFTransitionManager.git', :tag => '0.0.1'

Using

#####Global properties:

In AppDelegate add the following lines of code with whatever transition object you want. This will determine the animations that will be used as default.

[UIViewController setDefaultPresentationTransitions:[JHPullBackModalTransitionManager new]];
[UINavigationController setDefaultNavigationTransitions:[JHDropDownNavigationTransitionManager new]];
//don't set a modal transition to 'SFMainViewController'
[SFMainViewController setDefaultPresentationTransitions:nil];

#####Controller properties:

UIViewController * viewController = [UIViewController new];
viewController.presentationTransitions = [JHPullBackModalTransitionManager new];
UINavigationController * navigationController = [UINavigationController new];
navigationController.navigationTransitions = [JHDropDownNavigationTransitionManager new];

##Additional Animations:

To create a custom modal or navigation animation subclass JHModalTransitionManager and JHNavigationTransitionManager respectively.

Then, override the following methods:

- (void)animatePresentTransitionFrom:(UIViewController *)fromVC to:(UIViewController *)toVC withTransitionContext:(id<UIViewControllerContextTransitioning>)transitionContext {
   //TODO
}

- (void) animateDismissTransitionFrom:(UIViewController *)fromVC to:(UIViewController *)toVC withTransitionContext:(id<UIViewControllerContextTransitioning>)transitionContext {
    //TODO
}

Also override:

- (NSTimeInterval)transitionDuration:(id<UIViewControllerContextTransitioning>)transitionContext {
    if (self.transitionType == TransitionTypePresent) { // push and present
        return 1.0;
    } else { // dismissing and popping
        return 0.4;
    }
}

to set the animation duration.

##Built-in Transitions

#####Navigation:

  • JHNavigationTransitionTypeZoom
  • JHNavigationTransitionTypeDropDown

#####Modal:

  • JHModalTransitionTypeBounceUp
  • JHModalTransitionTypePullBack

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published