iOS App 上易于使用的 HUD
iOS 8.0 +
Xcode 8 +
Swift 3.0 +
你可以使用 CocoaPods 安装 ZKProgressHUD,在你的 Podfile 中添加:
ZKProgressHUD
Podfile
platform :ios, '8.0' use_frameworks! target 'MyApp' do pod 'ZKProgressHUD' end
拖动 ZKProgressHUD 文件夹到您的项目
将 ZKProgressHUD.bundle 添加到项目资源中 Targets->Build Phases->Copy Bundle Resources
ZKProgressHUD.bundle
Targets->Build Phases->Copy Bundle Resources
import ZKProgressHUD
ZKProgressHUD.show() // Simulation time consuming operation DispatchQueue.global().asyncAfter(deadline: DispatchTime.now() + .seconds(3), execute: { DispatchQueue.main.async { ZKProgressHUD.hide() } })
ZKProgressHUD.show("loading") // Simulation time consuming operation DispatchQueue.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)