TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Feb 2016 |
Maintained by Nick Donaldson, Michael Gorbach, Alex Rouse, Eric Slosser, Blake Skinner.
Copy and add all of the files in the RZTransitions
directory (and its subdirectories) into your project.
Swift
RZTransitionsManager.shared().defaultPresentDismissAnimationController = RZZoomAlphaAnimationController()
RZTransitionsManager.shared().defaultPushPopAnimationController = RZCardSlideAnimationController()
Objective C
id<RZAnimationControllerProtocol> presentDismissAnimationController = [[RZZoomAlphaAnimationController alloc] init];
id<RZAnimationControllerProtocol> pushPopAnimationController = [[RZCardSlideAnimationController alloc] init];
[[RZTransitionsManager shared] setDefaultPresentDismissAnimationController:presentDismissAnimationController];
[[RZTransitionsManager shared] setDefaultPushPopAnimationController:pushPopAnimationController];
When Presenting a View Controller
Swift
self.transitioningDelegate = RZTransitionsManager.shared()
let nextViewController = UIViewController()
nextViewController.transitioningDelegate = RZTransitionsManager.shared()
self.presentViewController(nextViewController, animated:true) {}
Objective C
[self setTransitioningDelegate:[RZTransitionsManager shared]];
UIViewController *nextViewController = [[UIViewController alloc] init];
[nextViewController setTransitioningDelegate:[RZTransitionsManager shared]];
[self presentViewController:nextViewController animated:YES completion:nil];
When creating a Navigation Controller ( or use RZTransitionsNavigationController )
Swift
let navigationController = UINavigationController()
navigationController.delegate = RZTransitionsManager.shared()
Objective C
UINavigationController *navigationController = [[UINavigationController alloc] init];
[navigationController setDelegate:[RZTransitionsManager shared]];
Swift
RZTransitionsManager.shared().setAnimationController( RZZoomPushAnimationController(),
fromViewController:self.dynamicType,
toViewController:RZSimpleCollectionViewController.self,
forAction:.PushPop)
Objective C
// Use the RZZoomPushAnimationController when pushing from this view controller to a
// RZSimpleCollectionViewController or popping from a RZSimpleCollectionViewController to
// this view controller.
[[RZTransitionsManager shared] setAnimationController:[[RZZoomPushAnimationController alloc] init]
fromViewController:[self class]
toViewController:[RZSimpleCollectionViewController class]
forAction:RZTransitionAction_PushPop];
Swift
override func viewDidLoad() {
super.viewDidLoad()
self.presentInteractionController = RZVerticalSwipeInteractionController()
if let vc = self.presentInteractionController as? RZVerticalSwipeInteractionController {
vc.nextViewControllerDelegate = self
vc.attachViewController(self, withAction:.Present)
}
}
override func viewWillAppear(animated: Bool)
{
super.viewWillAppear(animated)
RZTransitionsManager.shared().setInteractionController( self.presentInteractionController,
fromViewController:self.dynamicType,
toViewController:nil,
forAction:.Present)
}
Objective C
@property (nonatomic, strong) id<RZTransitionInteractionController> presentInteractionController;
- (void)viewDidLoad
{
[super viewDidLoad];
// Create the presentation interaction controller that allows a custom gesture
// to control presenting a new VC via a presentViewController
self.presentInteractionController = [[RZVerticalSwipeInteractionController alloc] init];
[self.presentInteractionController setNextViewControllerDelegate:self];
[self.presentInteractionController attachViewController:self withAction:RZTransitionAction_Present];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Use the present interaction controller for presenting any view controller from this view controller
[[RZTransitionsManager shared] setInteractionController:self.presentInteractionController
fromViewController:[self class]
toViewController:nil
forAction:RZTransitionAction_Present];
}
You can use any of the animation controllers or interaction controllers without the RZTransitionsManager and simply use them with the iOS7 custom View Controller transition APIs.
RZTransitions is licensed under the MIT license. See the LICENSE
file for details.