SunnyLoadings
示例
要运行示例项目,请克隆仓库,然后首先在 Example 目录中运行 pod install
。
要求
安装
SunnyLoadings 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod 'SunnyLoadings'
使用方法
- 实例化加载器类
let loader = Loader(vc: self)
- 要开始加载动画,调用 startAnimations 方法,指定您想要的加载指示器的位置和大小以及颜色
loader.startAnimations(x: self.view.bounds.midX, y: self.view.bounds.midY, size: self.view.bounds.width * 0.3, color: UIColor.white)
- 要结束动画,只需调用stopAllAnimations方法并传入特定情况,无论是成功:
loader.stopAllAnimations(result: .success)
还是失败:loader.stopAllAnimations(result: .failure)
附加说明
已知错误:当点击主页按钮返回应用,或更改视图控制器时,圆的展开和缩小动画会自动移除。要解决这个问题,开发者在离开视图时可以调用removeAnimationViews方法:loader.removeAnimationViews()
,再次显示视图时调用函数'startAnimations':loader.startAnimations(x: self.view.bounds.midX, y: self.view.bounds.midY, size: self.view.bounds.width * 0.3)
。
作者
ShennyO, [email protected]
许可证
SunnyLoadings遵循MIT许可证。更多信息请参阅LICENSE文件。