DayNightSwitch - 白天黑夜切换开关

发表于 4年以前  · 总阅读数:2980 次

DayNightSwitch

So I came across this awesome, kinda skeuomorphic-ish custom switch design on Dribbble and thought it was cute, so here you go:

gif

Installation

CocoaPods

  1. Add pod 'DayNightSwitch to your Podfile
  2. Run pod install

Manual

  1. Clone or download the repo, drop the DayNightSwitch.swift file in your project and
  2. Either drop a UIView into your storyboard and set its class to DayNightButton or create an instance of the switch like so:

Usage

    let dayNightSwitch = DayNightSwitch(center: self.view.center)
    dayNightSwitch.changeAction = { on in
        print("The switch is now " + (on ? "on" : "off"))
    }
    self.view.addSubview(dayNightSwitch)

License

Original credit for the design goes to Ramakrishna and for the animations to Tsuriel MIT.

DayNightSwitch - 白天黑夜切换开关

程序语言:Objective-C

 326个收藏

 5个关注

访问GitHub主页
 目录