ButtonProgressBar-iOS 1.0.1

ButtonProgressBar-iOS 1.0.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2018年2月
SwiftSwift版本4.0
SPM支持SPM

thePsguy维护。




ButtonProgressBar-iOS

GIF Preview

示例

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

GIF Preview

要求

iOS > 7.0

安装

ButtonProgressBar-iOS可通过CocoaPods获得。要安装它,只需在Podfile中添加以下行:

pod "ButtonProgressBar-iOS"

用法

import ButtonProgressBar_iOS


初始化就像您初始化任何其他UIButton一样

var progressButton = ButtonProgressBar(frame: CGRect)
view.addSubview(progressButton)

由于这是一个UIButton子类,目标和标签可以以相同的方式设置

progressButton.addTarget(nil, action: #selector(self.tapped), for: .touchUpInside)
progressButton.setTitle(Downloadpl-pds>, for: .normal)

可以通过以下方式设置完成图像;

此图像必须进行设置,因为没有默认设置。

  setCompletionImage(image: UIImage)

可以通过以下函数处理不确定加载

startIndeterminate(withTimePeriod time: TimeInterval)
startIndeterminate(withTimePeriod time: TimeInterval, andTimePadding padding: TimeInterval)

/ Time Padding is the duration (default 0.5), in seconds, before starting the next cycle. Time Period is the total time (animation + padding) that 1 cycle of the loading takes. /

stopIndeterminate() //Stops the indeterminate loading.


对于确定用法或其他情况,可以通过以下方式设置进度

setProgress(progress: CGFloat, _ animated: Bool) 
/
Progress ranges from 0.0 to 1.0

If animated is true, linearly animates to progress.
/

resetProgress() //Set progress to 0.0 unanimated.


设置进度和背景颜色

setBackgroundColor(color: UIColor)
setProgressColor(color: UIColor)

要显式显示/隐藏标题/图像

hideTitle( hidden: Bool)
hideImage( hidden: Bool)

停止活动的不确定加载,设置进度为1.0(动画),如果设置,则显示完成图像。

 Needs to be called explicitly when loading determinate as well.
  triggerCompletion()

作者

Pushkar Sharma,[email
protected]


灵感来源于Dribbble

安卓版本现已可用!

许可协议

ButtonProgressBar-iOS遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。