ZKProgressHUD 是一个iOSApp上易于使用的HUD。
运行环境iOS8.0+
Xcode8+
Swift3.0+
安装CocoaPods你可以使用 CocoaPods 安装 ZKProgressHUD,在你的 Podfile 中添加:
platform :ios, '8.0'use_frameworks!target 'MyApp' do pod 'ZKProgressHUD'end手动安装拖动 ZKProgressHUD 文件夹到您的项目
将 ZKProgressHUD.bundle 添加到项目资源中 Targets->BuildPhases->CopyBundleResources
使用导入 ZKProgressHUDimport ZKProgressHUD显示加载ZKProgressHUD.show()// Simulation time consuming operationDispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + .seconds(3), execute: { DispatchQueue.main.async { ZKProgressHUD.hide() }})显示加载和文字ZKProgressHUD.show("loading")// Simulation time consuming operationDispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + .seconds(3), execute: { DispatchQueue.main.async { ZKProgressHUD.hide() }})显示进度ZKProgressHUD.showProgress(1 / 10)显示图片ZKProgressHUD.showImage(UIImage(named: "image"))显示图片和文字ZKProgressHUD.showImage(UIImage(named: "image"), status: "Hello world")显示信息样式ZKProgressHUD.showInfo("Hello world")显示成功ZKProgressHUD.showSuccess("Hello world")显示错误ZKProgressHUD.showError("Hello world")显示消息(无图)ZKProgressHUD.showMessage("Hello world")隐藏ZKProgressHUD.hide()延迟隐藏ZKProgressHUD.hide(delay: 3)自定义ZKProgressHUD 可以通过下面方法进行自定义:
setMaskStyle (_ maskStyle : ZKProgressHUDMaskStyle )setMaskBackgroundColor(_ color: UIColor)setForegroundColor(_ color: UIColor)setBackgroundColor(_ color: UIColor)setFont(_ font: UIFont)setCornerRadius(_ cornerRadius: CGFloat)setAnimationStyle(_ animationStyle : ZKProgressHUDAnimationStyle )setHideDelay(_ hideDelay: Int)
评论