IndicatorButton 0.1.1

IndicatorButton 0.1.1

gwangyonglee 维护。



  • 作者:
  • gwangyonglee

IndicatorButton

CI Status Version License Platform

使用UIButton和UIActivityIndicatorView(UIButton包含简单动画)轻松管理状态值

示例

要运行示例项目,请克隆库,然后首先从示例目录运行 pod install

要求

  • iOS 12+
  • Swift 5

安装

IndicatorButton可以通过CocoaPods获得。要安装它,只需将以下行添加到Podfile中

pod 'IndicatorButton'

入门指南

Storyboard配置

在Storyboard中添加一个'UIButton'并将其类、模块设置好。

storyboard_setup

按钮动画设置

indicatorButton.type = .shake // case normal, pulse, shake, flash

动画启动 & 停止

  • 基本
// Start 
indicatorButton.startAnimating()


// Stop 
indicatorButton.stopAnimating()
  • 可回调的
indicatorButton.startAnimating {
  //
}
		
indicatorButton.stopAnimating {
  //
}

按钮状态改变

indicatorButton.isSelected = !indicatorButton.isSelected

自定义

UIButton标题颜色

titleColor: UIColor 指定UIButton的titleLabel文字颜色。(默认为黑色)

UIButton标题颜色(选中状态)

selectedTitleColor: UIColor (默认为白色)

UIButton图层背景颜色

bgColor: UIColor定义了UIButton图层的backgroundColor。(默认为白色)

UIButton图层背景颜色(选中)

selectedBgColor: UIColor (默认为黑色)

UIButton图层边框颜色

borderColor: UIColor定义了UIButton图层的边框颜色。(默认为透明)

UIButton图层边框颜色(选中)

selectedBorderColor: UIColor(默认为透明)

UIButton图层边框宽度

borderWidth: CGFloat定义了UIButton图层的边框宽度。(默认为'1.0')

UIButton图层圆角半径

cornerRadius: CGFloat定义了UIButton图层的圆角半径。(默认为'8.0')

UIButton 层阴影

withShadow: Bool 定义了 UIButton 是否应用阴影。 (默认为 'true')

UIButton 层阴影颜色

shadowColor: UIColor 定义 UIButton 的阴影颜色。 (默认为 .black)

UIActivityIndicatorView 颜色

indicatorColor: UIColor 定义 UIActivityIndicatorView 的颜色。 (默认为 .gray)

UIActivityIndicatorView 颜色(已选择)

selectedIndicatorColor: UIColor (默认为 .gray)

作者

gwangyonglee, 许可证

IndicatorButton 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。