Code Monkey home page Code Monkey logo

rztransitions's Introduction

RZTransitions

Build Status

RZTransitions is a library to help make iOS7 custom View Controller transitions slick and simple.

Overview

Installation

CocoaPods (Recommended)

Add the following to your Podfile:

pod 'RZTransitions'

RZTransitions follows semantic versioning conventions. Check the releases page for the latest updates and version history.

Manual Installation

Copy and add all of the files in the RZTransitions directory (and its subdirectories) into your project.

Setting a New Default Transition

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]];

Specifying Transitions for Specific View Controllers

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];

Hooking up Interactors

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];
}

Features

  • A comprehensive library of animation controllers
  • A comprehensive library of interaction controllers
  • Mix and match any animation controller with any interaction controller
  • A shared instance manager that helps wrap the iOS7 custom transition protocol to expose a friendlier API

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.

Maintainers

arrouse (@arrouse88)

nbonatsakis (@nickbona)

dostrander (@_Derko)

markpragma (@markpragma )

rztakashi

Contributors

smbarne (@smbarne)

License

RZTransitions is licensed under the MIT license. See the LICENSE file for details.

rztransitions's People

Contributors

alexrrouse avatar bskinner avatar chrisballinger avatar jatraiz avatar smbarne avatar zeveisenberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rztransitions's Issues

Layout not respected in destination view controller

Hi! First, great work with this library!
I'm using it in a Swift project, but I'm having problems with the layout of the destination view controller that is not respected.
I've added this line in my AppDelegate :
RZTransitionsManager.shared().defaultPushPopAnimationController = RZZoomPushAnimationController()
And this in my ToViewController :
self.navigationController?.delegate = RZTransitionsManager.shared()

The transition is working very good, but in my DestinationViewController the layout isn't respected because some labels are put behind the navigation bar (which has the translucent property set to false). How can I solve this?

UIModalPresentationOverCurrentContext causes white screen

When using UIModalPresentationOverCurrentContext as model presentation style (because i want view as see through) causes a white screen on dismissal. Here is my code.

'
[vc setTransitioningDelegate:[RZTransitionsManager shared]];
[vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];
[self presentViewController:vc animated:YES completion:NULL];
'

if i remove
' [vc setModalPresentationStyle:UIModalPresentationOverCurrentContext];' all works fine as expected.

RZZoomPushAnimationController calls viewWillAppear:

My UIViewController had its viewWillAppear: method getting called twice – once by RZZoomPushAnimationController and then again by the system, causing some unnecessary work to be done. RZZoomPushAnimationController's animateTransition: method explicitly calls [toViewController viewWillAppear:YES]. This seems wrong to me because the system already automatically calls UIViewController's viewWillAppear: when appropriate.

I haven't read any documentation to indicate that viewWillAppear: should ever be explicitly called. Is its use here an undocumented bug workaround or does it need to be called for any reason? I removed it (because that seems like the better alternative than adding a guard to viewWillAppear:) and everything works as expected now (work is not done twice).

[Question] Implement RZTransitionInteractionController inside each view controller to make transition interactive?

On application launch I set the default animation controllers for RZTransitionsManager:

let manager = RZTransitionsManager.shared()
manager.defaultPresentDismissAnimationController = RZZoomPushAnimationController()
manager.defaultPushPopAnimationController = RZZoomPushAnimationController()

Custom transition is working well when I push or pop the view controller inside of navigation stack. But transition is not interactive. Pan gesture from screen edge closes view controller immediately and it’s not possible to stop the transition.

The question is: should I implement RZTransitionInteractionController inside each view controller to make transition interactive? Or, maybe, there’s an easier way?

Create Podspec

@smbarne I'm going to create a podspec in a branch off of develop. Once it's linted, there will need to be a tagged release and merge to master.

[RZTransitionsManager setInteractionController:...] doesn't return what it promised

The header doc for [RZTransitionsManager setInteractionController: fromViewController:toViewController:forAction:] claims it'll return a unique key to reference the pairing, but...

  1. due to a shadowed variable bug, it always returns nil
  2. the way it's currently written, there is no 'unique key' to return. It adds as many objects to the map as there are bits set in the action.

Complete the appledoc commenting

Some stuff is commented using appledoc, some stuff isn't. Full coverage means that the CocoaDocs page will serve as complete API documentation.

Need latest swift support

We are using this library for custom View Controller transitions and it's really awesome and this library does not support lates swift version. Could you add support for latest swift version?

When toController is model , the auto layout breaks after animation finishes.

When toController is model , the auto layout breaks after animation finishes. To reproduce , set default animations as follows.

'id presentDismissAnimationController = [[RZZoomAlphaAnimationController alloc] init];
id pushPopAnimationController = [[RZZoomAlphaAnimationController alloc] init];
[[RZTransitionsManager shared] setDefaultPresentDismissAnimationController:presentDismissAnimationController];
[[RZTransitionsManager shared] setDefaultPushPopAnimationController:pushPopAnimationController];'

Now present the controller as follows

' [vc setTransitioningDelegate:[RZTransitionsManager shared]];
[self presentViewController:vc animated:YES completion:NULL];'

The vc layout doesnt get adjusted based on screen size.

Singleton pattern

Should RZTransitionsManager be used always as a singleton?
I have 2 Separated navigation controller and i want assign a default different transition to each.
Is it possible?

Create a RZTransition NavigationDelegate Helper

Create an object that can be assigned as the nav controller's delegate for transitions.

  • It should contain a map of what VC classes to transition between and what transition to use.
  • It should have a default transition to use if no specific mappings are found
  • It should set the positive or negative direction on an RZTransition if the transition complies with the protocol based on a push or pop.

Optional / Further Work

  • Create an object that can be assigned as the transition delegate. It should handle present and dismiss animations. If possible, this object could/should be the same as the nav controller delegate helper.

RZVerticalSwipeInteractionController Bug

Seems it breaks up UIViewController hierarchy in some situation.

1: Run RZTransition-Demo.
2: Push "present" and open modal view,
3: Swipe down view with interaction transitioning.
4: While swiping down, swiping up and try to cancel.
5: It breaks transition and present modal view action.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.