• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Ramotion/paper-switch:

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

Ramotion/paper-switch

开源软件地址(OpenSource Url):

https://github.com/Ramotion/paper-switch

开源编程语言(OpenSource Language):

Swift 93.7%

开源软件介绍(OpenSource Introduction):

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:


CocoaPods CocoaPods CocoaPods Carthage compatible Twitter Travis Donate

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.

  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)
}


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap