Giter Site home page Giter Site logo

slimbn / paper-switch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ramotion/paper-switch

0.0 2.0 0.0 1.42 MB

RAMPaperSwitch is a Swift module which paints over the parent view when the switch is turned on.

Home Page: https://business.ramotion.com/gthb-casestudies

License: MIT License

Swift 92.67% Objective-C 3.72% Ruby 3.61%

paper-switch's Introduction

header #RAMPaperSwitch CocoaPods CocoaPods CocoaPods Carthage compatible Twitter Travis Analytics

About

This project is maintained by Ramotion, Inc.
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Looking for developers for your project? [▶︎CONTACT OUR TEAM◀︎]

#Screenshot PaperSwitch

The iPhone mockup available here.

Requirements

  • iOS 8.0+
  • Xcode 6.1

#Installation

Just add the RAMPaperSwitch folder to your project.

or use CocoaPods with Podfile:

pod 'RAMPaperSwitch', '~> 1.0.7' swift 2.2

pod 'RAMPaperSwitch', '~> 2.0.0' swift 3

or Carthage users can simply add to their Cartfile:

github "Ramotion/paper-switch"

#Usage RAMPaperSwitch is a drop-in replacement of UISwitch. You just need to set the onTintColor property of the switch, and it will automatically paint over its superview with the selected color. You have ability to set duration of animation instead of default value.

  1. Create a new UISwitch in your storyboard or nib.

  2. Set the class of the UISwitch to RAMPaperSwitch in your Storyboard or nib.

  3. Set onTintColor for the switch

  4. Set duration property programmatically if You want to change animation duration.

  5. Add animation for other views near the switch if need.

#Animate views You can animate other views near the switch. For example, you can change color to views or labels that are inside the same superview. Duration of animation can be gotten from the RAMPaperSwitch's property duration. You can animate CoreAnimation properties like this:

self.paperSwitch.animationDidStartClosure = {(onAnimation: Bool) in
    UIView.transitionWithView(self.label, duration: self.paperSwitch.duration, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: {
        self.label.textColor = onAnimation ? UIColor.whiteColor() : UIColor.blueColor()
    }, completion:nil)
}

Folow Us

Twitter URL Twitter Follow

paper-switch's People

Contributors

0ber avatar juriv avatar ooleynich avatar aleksei1000000 avatar ramotiondev avatar devladinci avatar eddpt avatar ramotionrussell avatar kaphacius avatar

Watchers

James Cloos avatar Slim Ben Nasrallah 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.