ARSLineProgress 3.1.1

ARSLineProgress 3.1.1

测试测试通过
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2021年12月
SPM支持 SPM

Yaroslav Arsenkin 维护。



ARSLineProgress

ARSLineProgress GitHub license Carthage compatible

iOS 进度条,可作为 iOS 活动指示器的替代品。这个进度 HUD 将为您的应用程序添加一些美观的效果。此外,您可以通过自定义结构来定制此进度加载器。

无限 成功 失败 无状态动画
ARSLineProgress Infinite ARSLineProgress Success ARSLineProgress Fail ARSLineProgress NoState
确定 错误
ARSLineProgress OK ARSLineProgress Error

安装

Carthage

要使用 Carthage 进行安装,只需在您的 Cartfile 中指定即可

github "soberman/ARSLineProgress" >= 3.1

如果您还未安装 Carthage,可以使用 Homebrew 进行安装

$ brew update
$ brew install carthage

我还建议参考一下“Carthage”描述中的本节内容,当你为iOS、tvOS或WatchOS构建时

CocoaPods

使用CocoaPods安装,请将以下内容复制到您的Podfile文件中

use_frameworks!
platform :ios, '8.0'
pod 'ARSLineProgress', '~> 3.1'

新手方法

您始终坚持使用传统方法——只需将源文件拖放到项目中即可。

用法

ARSLineProgress使使用变得非常简单——您有ARSLineProgress类,提供了一连串用于显示加载进度的方法。

显示

您可以在两种模式下显示进度指示器:无限模式和进度模式。无限模式会一直显示,直到您手动隐藏它。

class func show()
class func showWithPresentCompetionBlock(block: () -> Void)
class func showOnView(view: UIView)
class func showOnView(view: UIView, completionBlock: () -> Void)

class func hide()
class func hideWithCompletionBlock(block: () -> Void)

进度指示器将在NSProgress对象的fractionCompleted值达到1.0或传递原始值时显示100.0

class func showWithProgressObject(progress: NSProgress)
class func showWithProgressObject(progress: NSProgress, completionBlock: (() -> Void)?)
class func showWithProgressObject(progress: NSProgress, onView: UIView)
class func showWithProgressObject(progress: NSProgress, onView: UIView, completionBlock: (() -> Void)?)

// Updating progress in case you are using on of the methods above:
class func updateWithProgress(value: CGFloat)

// initialValue should be from 0 to 100 in these methods
class func showWithProgress(initialValue value: CGFloat)
class func showWithProgress(initialValue value: CGFloat, completionBlock: (() -> Void)?)
class func showWithProgress(initialValue value: CGFloat, onView: UIView)
class func showWithProgress(initialValue value: CGFloat, onView: UIView, completionBlock: (() -> Void)?)

您可以使用这些方法只显示“成功”勾选标记或失败

static func showSuccess()
static func showFail()
隐藏

隐藏ProgressHUD可以类似于您之前处理无限加载器的方式,或者您可以使用这些专用方法

class func cancelPorgressWithFailAnimation(showFail: Bool)
class func cancelPorgressWithFailAnimation(showFail: Bool, completionBlock: (() -> Void)?)

定制

您可以通过 ARSLineProgressConfiguration 结构来定制进度HUD,该结构提供了丰富的定制选项。任何更改只有在显示预加载器之前设置,才会可见;否则,将在下一次显示预加载器时可见。

一旦您改变主意,想将 ARSLineProgressConfiguration 恢复为默认参数,请使用 static func restoreDefaults() 方法。

其他

ARSLineProgress 会自动响应用户界面方向更改,因此它会始终在屏幕上居中显示。

许可

ARSLineProgress 采用 MIT 许可 发布。详情请见 LICENSE 文件。