Ramotion/paper-switch
关于
:octocat: 🎚 RAMPaperSwitch 是一个 Swift Material Design UI 模块,打开开关后会覆盖绘制父视图。由 @Ramotion 开发的 iOS 库
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -2
- 1个月
- -4
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文
PAPER SWITCH
A Swift material design UI module which paints over the parent view when the switch is on.
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
Stay tuned for the latest updates:
Requirements
- iOS 8.0+
- Xcode 9.0+
Installation
Just add the RAMPaperSwitch folder to your project.
or use CocoaPods with Podfile:
pod 'RAMPaperSwitch'
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.
Create a new UISwitch in your storyboard or nib.
Set the class of the UISwitch to RAMPaperSwitch in your Storyboard or nib.
Set
onTintColorfor the switchSet
durationproperty programmatically if You want to change animation duration.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)
}
📄 License
Paper Switch is released under the MIT license. See LICENSE for details.
This library is a part of a selection of our best UI open-source projects.
If you use the open-source library in your project, please make sure to credit and backlink to www.ramotion.com
📱 Get the Showroom App for iOS to give it a try
Try this UI component and more like this in our iOS app. Contact us if interested.
探索相关项目
加载中…
