Git Product home page Git Product logo

lczoomtransition's Introduction

LCZoomTransition

A custom UIViewController animated and interactive transition for use in master detail apps that uses a zoom in effect when going from master to detail and a zoom out effect when going back to the master view.

When returning to the master view the 'back' transition can be interactively controlled by either a pinch gesture or the standard iOS 7 screen edge pan 'back' gesture.

As used in my app ThenDo

Requirements

  • iOS 7.0 or later.
  • ARC memory management.

Usage

The easiest way to install it is by copying the following to your project:

  • LCZoomTransition.h

  • LCZoomTransition.m

  • In your master view controller, initialize an instance of an LCZoomTransition, passing it your navigation controller:

      self.zoomTransition = [[LCZoomTransition alloc] initWithNavigationController:self.navigationController];
    
  • Add a property to your detail view controller to be able to make the transition a gesture target:

      @property (nonatomic, strong) id<LCZoomTransitionGestureTarget> gestureTarget;
    
  • In prepareForSegue in your master view controller tell the transition which cell (view) originated the transition and, optionally, set the gesture target on the detail view controller (if you want to uyse the interactive 'back' gestures):

    // the transition controller needs to know the view (cell)
    // that originated the segue in order to be able to "split"
    // the table view correctly
    self.zoomTransition.sourceView = [self.tableView cellForRowAtIndexPath:indexPath];

    // pass the custom transition to the destination controller
    // so it can use it when setting up its gesture recognizers
    [[segue destinationViewController] setGestureTarget:self.zoomTransition];
  • If you want the interactive 'back' gestures, in viewDidLoad in your detail view controller setup the gesture recognizers:
    // setup a pinch gesture recognizer and make the target the custom transition handler
    UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self.gestureTarget action:@selector(handlePinch:)];
    [self.view addGestureRecognizer:pinchRecognizer];
    
    // setup an edge pan gesture recognizer and make the target the custom transition handler
    UIScreenEdgePanGestureRecognizer *edgePanRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self.gestureTarget action:@selector(handleEdgePan:)];
    edgePanRecognizer.edges = UIRectEdgeLeft;
    [self.view addGestureRecognizer:edgePanRecognizer];
  • That's it! See the included example project to see it in action.

License

Copyright © 2013 Michael Brown

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Bitdeli Badge

lczoomtransition's People

Contributors

bitdeli-chef avatar mluisbrown avatar scottphc avatar

Watchers

 avatar  avatar

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.