按钮

Version Build Status Swift Version

一个 UIButton 子类,可以方便地使用 UIColor 作为不同按钮状态的背景和边框颜色。

安装

Swift 包管理器

对于使用 Swift 包管理器 进行安装,只需将以下内容添加到您的 Package.swift 文件中

.package(url: "https://github.com/lipka/Button", from: "0.1.0")

用法

背景颜色

您可以调用 setBorderColor(_:, for:) 来设置不同 UIControl.State 的背景颜色。

import Button

let button = Button()
button.setBackgroundColor(UIColor.red, for: .normal)
button.setBackgroundColor(UIColor.blue, for: .highlighted)

边框颜色

您可以调用 setBorderColor(_:, for:) 来设置不同 UIControl.State 的边框颜色。

import Button

let button = Button()
button.setBorderColor(UIColor.red, for: .normal)
button.setBorderColor(UIColor.blue, for: .highlighted)