Giter Site home page Giter Site logo

m4tbat / awpercentdriveninteractivetransition Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mralek/awpercentdriveninteractivetransition

0.0 1.0 0.0 88 KB

A drop-in replacement for UIPercentDrivenInteractiveTransition for use in custom container view controllers.

License: MIT License

Objective-C 88.75% Ruby 11.25%

awpercentdriveninteractivetransition's Introduction

AWPercentDrivenInteractiveTransition

AWPercentDrivenInteractiveTransition is a drop-in replacement for UIPercentDrivenInteractiveTransition for use in custom container view controllers.

Why do you need it? Because Apples own UIPercentDrivenInteractiveTransition calls undocumented methods on your custom UIViewControllerContextTransitioning objects.

Note that this class can be used with UIKits standard container view controllers such as UINavigationController, UITabBarController and also for presenting modal view controllers.

Status

0.1.0 - Basic functionality implemented, usable for a majority of cases

Unimplemented features

  • completionSpeed can't be changed from 1.0
  • completionCurve can't be changed from UIViewAnimationCurveLinear
  • No support for UIViewControllerTransitionCoordinator (for animating other views along transition)

Installation

Cocoapods

CocoaPods is the recommended way to add AWPercentDrivenInteractiveTransition to your project.

  1. Add a pod entry for AWPercentDrivenInteractiveTransition to your Podfile pod 'AWPercentDrivenInteractiveTransition', '~> 0.1'
  2. Install the pod(s) by running pod install.
  3. Include AWPercentDrivenInteractiveTransition wherever you need it with #import "AWPercentDrivenInteractiveTransition.h".

Source files

Alternatively you can directly add the AWPercentDrivenInteractiveTransition.h and AWPercentDrivenInteractiveTransition.m source files to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop AWPercentDrivenInteractiveTransition.h and AWPercentDrivenInteractiveTransition.m onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Include AWPercentDrivenInteractiveTransition wherever you need it with #import "AWPercentDrivenInteractiveTransition.m".

Static library

If you don't want to compile my code all the time, there's an XCode project in the lib folder which generates a static libAWPercentDrivenInteractiveTransition.a library file you can include in your project. Just remember to include the original LICENCE file in your source code.

Usage

Use as you would do with a regular UIPercentDrivenInteractiveTransition. Either by letting your custom interaction controller subclass AWPercentDrivenInteractiveTransition or by having an instance and manually call the updateInteractiveTransition:, cancelInteractiveTransition and finishInteractiveTransition methods.

The only difference is that you need to set the animator property with a UIViewControllerAnimatedTransitioning object before starting an interactive transition.

This is what the standard UIPercentDrivenInteractiveTransition does by calling private methods on your UIViewControllerContextTransitioning object.

There's also a convinience initializer called initWithAnimator: that sets the animator property directly.

Demo

If you wanna se a demo of this drop-in replacement class in action, check out my blog post on Interactive Custom Container View Controller Transitions.

Licence

This code is distributed under the terms and conditions of the MIT license.

awpercentdriveninteractivetransition's People

Contributors

m4tbat avatar mralek avatar

Watchers

 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.