ZKProgressHUD iOS 易于使用的 HUD

ZKProgressHUD是一款用于iOS应用的轻量级HUD组件,支持多种样式展示如加载、进度、图片等,并提供了丰富的自定义选项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

(logo)

ZKProgressHUD

GitHub - ZKProgressHUD

iOS App 上易于使用的 HUD

demo

运行环境

  • iOS 8.0 +

  • Xcode 8 +

  • Swift 3.0 +

安装

CocoaPods

你可以使用 CocoaPods 安装 ZKProgressHUD,在你的 Podfile 中添加:

platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'ZKProgressHUD'
end

手动安装

  • 拖动 ZKProgressHUD 文件夹到您的项目

  • ZKProgressHUD.bundle 添加到项目资源中 Targets->Build Phases->Copy Bundle Resources

使用

导入 ZKProgressHUD

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)

自定义

style1
style2
style3
style4
style5
style6
style7
style8

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)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值