美文网首页
UINavigationController+Animation

UINavigationController+Animation

作者: liwp_Stephen | 来源:发表于2016-09-29 10:04 被阅读0次

This code add custom animation effect to UINavigationController, this code is get from network.

UINavigationController+Animation.h

#import <Foundation/Foundation.h>

@interface UINavigationController (Animation)

- (void) pushViewControllerWithFlip:(UIViewController*) controller;

- (void) popViewControllerWithFlip;

@end

UINavigationController+Animation.m

#import "UINavigationController+Animation.h"

@implementation UINavigationController (Animation)

- (void) pushViewControllerWithFlip:(UIViewController *) controller
{
    [UIView animateWithDuration:0.50
                     animations:^{
                         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                         [self pushViewController:controller animated:NO];
                         [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:NO];
                     }];
}

- (void) popViewControllerWithFlip
{
    [UIView animateWithDuration:0.5
                     animations:^{
                         [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
                         [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:NO];
                     }];
    
    [self popViewControllerAnimated:NO];
}

@end

相关文章

网友评论

      本文标题:UINavigationController+Animation

      本文链接:https://www.haomeiwen.com/subject/ecvkyttx.html