测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可协议 | MIT |
发布最新发布 | 2015 年 3 月 |
SPM支持 SPM | ✗ |
由 Vidar Ottosson 维护。
在处理动作时动画的 iOS 按钮编写的英文。Swift 编程语言。
这个库是从一个我当时正在工作的 iOS 应用程序中提取出来的。它用于任何异步处理动作,并在动作完成后显示类似加载的动画。
基本异步任务动画
@IBOutlet weak var btnSignIn: ProcessButton!
btnSignIn.animate(true)
// Do some some asynchronous stuff here
// and display result from callback
if callbackSuccess {
self.btnSignIn.showSuccessText("Success", seconds: ProcessButtonUtil.Length.Short)
} else {
self.btnSignIn.showErrorText("Error", seconds: ProcessButtonUtil.Length.Long)
}
可选 要更改线条颜色和持续时间,请将以下内容放在您的 AppDelegate 的 didFinishLaunchingWithOptions
// App wide customization
let colors = [UIColor.blueColor(), UIColor.redColor(), UIColor.greenColor()]
let duration: NSTimeInterval = 0.3
ProcessButtonUtil.sharedInstance
.setColors(colors) // The colors for the animating lines. Can be any number of colors
.setDuration(duration) // The time for each line to animate. Default is 0.5
查看项目以查看完整示例。
Vidar Ottosson,[email protected]
ProcessButton 在 MIT 许可协议下提供。有关更多信息,请参阅 LICENSE 文件。