APESuperHUD 2.0.1

APESuperHUD 2.0.1

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2018年5月
SPM支持SPM

Daniel NilssonErik Fagerman维护。



APESuperHUD

在应用程序中显示消息或进度信息的一种简单方式。

APESuperHUD

特色功能

  • 简单。
  • 可定制。请参阅更改外观
  • 完全用Swift编写。
  • 单元测试。

要求

  • iOS 9 或更高版本。
  • Xcode 9(Swift 4.1)或更高版本。
    • 对于Swift 3.0,请使用版本1.1.3
    • 对于Swift 2.2,请使用版本0.6

安装

CocoaPods

您可以使用 CocoaPods 通过将其添加到 Podfile 中来安装 APESuperHUD

platform :ios, '9.0'
use_frameworks!

target 'MyApp' do
    pod 'APESuperHUD', :git => 'https://github.com/apegroup/APESuperHUD.git'
end

请注意,这需要 CocoaPods 版本 36,以及您的 iOS 部署目标至少为 9.0

Carthage

您可以使用 Carthage 通过将其添加到 Cartfile 中来安装 APESuperHUD

github "apegroup/APESuperHUD"

使用方法

不要忘了导入。

import APESuperHUD

显示带图标的 hud

let image = UIImage(named: "apegroup")!
APESuperHUD.show(style: .icon(image: image, duration: 3.0), title: "Hello", message: "world")

// Or create a instance of APESuperHud

/*
let hudViewController = APESuperHUD(style: .icon(image: image, duration: 3), title: "Hello", message: "world")
present(hudViewController, animated: true)
*/

显示带加载指示器的 hud

APESuperHUD.show(style: .loadingIndicator(type: .standard), title: nil, message: "Loading...")

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    APESuperHUD.dismissAll(animated: true)
})

// Or create a instance of APESuperHud

/*
let hudViewController = APESuperHUD(style: .loadingIndicator(type: .standard), title: nil, message: "Loading...")
present(hudViewController, animated: true)

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    hudViewController.dismiss(animated: true)
})
*/

显示带标题和消息的 hud

APESuperHUD.show(style: .textOnly, title: "Hello", message: "world")

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    APESuperHUD.dismissAll(animated: true)
})

// Or create a instance of APESuperHud

/*
let hudViewController = APESuperHUD(style: .textOnly, title: "Hello", message: "world")
present(hudViewController, animated: true)

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    hudViewController.dismiss(animated: true)
})
*/

显示带有更新的HUD

APESuperHUD.show(style: .loadingIndicator(type: .standard), title: nil, message: "Loading...")

DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
    APESuperHUD.show(style: .textOnly, title: "Done loading", message: nil)

    DispatchQueue.main.asyncAfter(deadline: .now() + 3.0, execute: {
        let image = UIImage(named: "apegroup")!
        APESuperHUD.show(style: .icon(image: image, duration: 3.0), title: nil, message: nil)
    })
})

更改外观

/// Text color of the title text inside the HUD
HUDAppearance.titleTextColor = UIColor.black

/// Text color of the message text inside the HUD
HUDAppearance.messageTextColor = UIColor.black

/// The color of the icon in the HUD
HUDAppearance.iconColor = UIColor.black

/// The background color of the view where the HUD is presented
HUDAppearance.backgroundColor = UIColor.black.withAlphaComponent(0.5)

/// The background color of the HUD view
HUDAppearance.foregroundColor = UIColor.white

/// The color of the loading indicator
HUDAppearance.loadingActivityIndicatorColor = UIColor.gray

/// The corner radius of the HUD
HUDAppearance.cornerRadius = 10.0

/// Enables/disables shadow effect around the HUD
HUDAppearance.shadow = true

/// The shadow color around the HUD
HUDAppearance.shadowColor = UIColor.black

/// The shadow offset around the HUD
HUDAppearance.shadowOffset = CGSize(width: 0, height: 0)

/// The shadow radius around the HUD
HUDAppearance.shadowRadius = 6.0

/// The shadow opacity around the HUD
HUDAppearance.shadowOpacity = 0.15

/// Enables/disables removal of the HUD if the user taps on the screen
HUDAppearance.cancelableOnTouch = true

/// The info message font in the HUD
HUDAppearance.messageFont = UIFont.systemFont(ofSize: 13, weight: .regular)

/// The title font in the HUD
HUDAppearance.titleFont = UIFont.systemFont(ofSize: 20, weight: .bold)

/// The size of the icon inside the HUD
HUDAppearance.iconSize = CGSize(width: 48, height: 48)

/// The HUD size
HUDAppearance.hudSize = CGSize(width: 144, height: 144)

/// The HUD fade in duration
HUDAppearance.animateInTime = 0.7

/// The HUD fade out duration
HUDAppearance.animateOutTime = 0.7

贡献

所有人均欢迎贡献。请见《贡献》部分以获取详细信息。

许可证

APESuperHUD是在MIT许可证下发布的。请见《许可证》部分以获取详细信息。