iOS 视图切换动画:PortalTransition

ddvd 4年前

PortalTransition 受 Apple 的主题门户动画启发,在是 iOS 实现类似的 UIViewController 切换。

iOS 视图切换动画:PortalTransition

Requirements

PortalTransition supports iOS 7.0 and later,

Dependencies:

  • CoreGraphics.framework
  • QuartzCore.framework

Usage

Copy PortalTransition folder to your project

Present a UIViewController

Set a viewControllerTransitionDelegate

#import "CYViewControllerTransitioningDelegate.h"    @interface ViewController ()    @property (nonatomic, strong) CYViewControllerTransitioningDelegate *viewControllerTransitionDelegate;    @end      // Instatiate transitionDelegate  self.viewControllerTransitionDelegate = [CYViewControllerTransitioningDelegate new];    NewViewController *newVC = [NewViewController new];  newVC.modalPresentationStyle = UIModalPresentationCustom;  // Set the presentedViewController to delegate's viewController, it will implemente delegate methods for you  self.viewControllerTransitionDelegate.viewController = newVC;  // Just push your viewController  [self presentViewController:newVC animated:YES completion:nil];

Use custom category methods
#import "UIViewController+PortalTransition.h"    // Just call the custom present method  [self presentPortalTransitionViewController:newVC completion:nil];

Push a UIViewController to your UINavigationController's viewcontroller stack

Set a viewControllerTransitionDelegate

#import "CYNavigationControllerDelegate.h"    @interface ViewController ()    @property (nonatomic, strong) CYNavigationControllerDelegate *navDelegate;    @end      // Instatiate transitionDelegate  self.navDelegate = [CYNavigationControllerDelegate new];    NewViewController *newVC = [NewViewController new];  // Set your navigation controller to your navDelegate  self.navDelegate.navController = self.navigationController;  [self presentViewController:newVC animated:YES completion:nil];

项目主页:http://www.open-open.com/lib/view/home/1435289470669