CustomSwitch 0.1.1

CustomSwitch 0.1.1

Dimitrios Kalaitzidis 维护。




CustomUISwitch

一个自定义的 UIControl 类,可以从 Storyboards 或代码中使用作为 UISwitch。

为什么需要 CustomUISwitch

嗨!最近我收到了 Orfium(https://www.orfium.com)提供的关于新 iOS 的一些 mockups,它们的身份将被保密。

其中一个屏幕包含一个自定义的 UISwitch,这是我首先着手解决的一个问题 ;)

您将获得什么

Custom UISwitch

如何安装

此库有两种安装方式

手动

  • 简单地将 'CustomSwitch.swift' 文件拖到您的项目中
  • 下载 Assets 文件夹并将其添加到您的项目中

CocoaPods

将其添加到您的 podfile 中

pod 'CustomSwitch', '~> 0.1'

如何使用

故事板

  • 将 UIView 添加到 UIViewController 中,并将类更改为 CustomSwitch,完成!一些属性已对外公开供用户修改。

代码

  • 通过代码创建 CustomSwitch
let myCustomSwitch = CustomSwitch(frame: CGRect(x: 50, y: 50, width: 48, height: 14))
self.view.addSubview(myCustomSwitch)

可用属性

  • animationDuration: Double
  • isOn: Bool
  • isOnImage: String
  • isOffImage: String
  • onTintColor: UIColor
  • offTintColor: UIColor
  • padding: CGFloat
  • thumbOnTintColor: UIColor
  • thumbOffTintColor: UIColor
  • thumbTintColor: UIColor