iProgressHUD 1.1.1

iProgressHUD 1.1.1

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2018年1月
SPM支持 SPM

icaksama 维护。



iProgressHUD

Creator
Travis
GitHub license
Code Size
Pod Version
Platform
Download Total


一个优雅、轻量级且响应式的进度 HUD 用于 iOS 应用,使用非常简单。提供 NVActivityIndicatorView 的 32 个指示器。您的视图可以直接调用开始和停止进度,无需再编写代码。

特性

  • 响应式
  • 可定制
  • 全动画
  • 通过 NVActivityIndicatorView 提供 32 个指示器
  • 支持模态视图、消失和触摸功能
  • 在各种视图中显示和停止进度
  • 支持垂直和水平样式
  • 非常简单易用!

预览

Cocoapods

添加到 Podfile

pod 'iProgressHUD', '~> 1.1.1'

指示器类型

类型 类型 类型 类型
1. ballPulse 2. ballGridPulse 3. ballClipRotate 4. squareSpin
5. ballClipRotatePulse 6. ballClipRotateMultiple 7. ballPulseRise 8. ballRotate
9. cubeTransition 10. ballZigZag 11. ballZigZagDeflect 12. ballTrianglePath
13. ballScale 14. lineScale 15. lineScaleParty 16. ballScaleMultiple
17. ballPulseSync 18. ballBeat 19. lineScalePulseOut 20. lineScalePulseOutRapid
21. ballScaleRipple 22. ballScaleRippleMultiple 23. ballSpinFadeLoader 24. lineSpinFadeLoader
25. triangleSkewSpin 26. pacman 27. ballGridBeat 28. semiCircleSpin
29. ballRotateChase 30. orbit 31. audioEqualizer 32. circleStrokeSpin

使用方法

快速使用

您可以使用默认设置进行快速使用。

import iProgressHUD

class ViewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
        // Attach iProgressHUD to views
        iProgressHUD.sharedInstance().attachProgress(toView: self.view)
        // Show iProgressHUD directly from view
        view.showProgress()
    }
}

自定义使用

您可以在项目中自定义 iProgressHUD。请参阅 iProgressHUD 设置。

import iProgressHUD

class ViewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
        let iprogress: iProgressHUD = iProgressHUD()
        iprogress.isShowModal = true
        iprogress.isShowCaption = true
        iprogress.isTouchDismiss = true
        
        // Attach iProgressHUD to views
        iprogress.attachProgress(toViews: view, view1, view2, view3)
        
        // Show iProgressHUD directly from view
        view.showProgress()
        view1.showProgress()
        view2.showProgress()
        view3.showProgress()
    }
}

显示/消失 iProgressHUD

您可以从已附加进度的视图中直接显示或消失 iProgressHUD。

// Show iProgressHUD directly from view
view.showProgress()
// Stop iProgressHUD directly from view
view.dismissProgress()

飞行中更新标题和指示器

您可以直接从视图更改标题和指示器类型。

// Change caption on the fly directly from the view
view.updateCaption(text: "New Caption Here!")
// Change indicator type on the fly directly from the view
view.updateIndicator(style: .ballBeat)

添加委托

将 iProgressHUDDelegete 添加到您的类/ViewController 中,以获取显示、消失或触摸响应。此方法为可选实现。

import iProgressHUD

class ViewController: UIViewController, iProgressHUDDelegete {
    override func viewDidAppear(_ animated: Bool) {
        let iprogress: iProgressHUD = iProgressHUD()
        
        // Set the delegete
        iprogress.delegete = self

        // Attach iProgressHUD to views
        iprogress.attachProgress(toViews: view)

        // Show iProgressHUD directly from view
        view.showProgress()
    }
    
    func onShow(view: UIView) {
        print("onShow")
    }
    
    func onDismiss(view: UIView) {
        print("onStop")
    }
    
    func onTouch(view: UIView) {
        print("onTouch")
    }
}

iProgressHUD 设置

/** Setting indicator style. Default is ballClipRotatePulse. */
iprogress.indicatorStyle = .ballClipRotatePulse

/** Setting iprogress style in vertical or horizontal. Default is vertical. */
iprogress.iprogressStyle = .vertical

/** Setting the indicator size in percent of box view. Default is 60%. */
iprogress.indicatorSize = 60

/** Setting the alpha of modal view. Default is 0.7 */
iprogress.alphaModal = 0.7

/** Setting the alpha of box view. Default is 0.7 */
open var alphaBox: CGFloat = 0.7

/** Setting box size in percent of width view. Default is 50%. */
iprogress.boxSize = 50

/** Setting the corner radius of box view. Default is 12. */
iprogress.boxCorner = 12

/** Setting the caption distance with indicator view. Default is 0. */
iprogress.captionDistance = 0

/** Show or hide the caption view. Default is true. */
iprogress.isShowCaption = true

/** Show or hide the modal view. Default is true. */
iprogress.isShowModal = true

/** Show or hide the box view. Default is true. */
iprogress.isShowBox = true

/** Give blur effect in modal view. Default is false. */
iprogress.isBlurModal = false

/** Give blur effect in box view. Default is false. */
iprogress.isBlurBox = false

/** Make the progress touchable. Default is false. */
iprogress.isTouchDismiss = false

/** Change the modal view color. Default is white. */
iprogress.modalColor = .white

/** Change the box view color. Default is black. */
iprogress.boxColor = .black

/** Change the text color of caption. Default is white. */
iprogress.captionColor = .white

/** Change the indicator view color. Default is white. */
iprogress.indicatorColor = .white

/** Change the font size of caption. Default is 20. */
iprogress.captionSize = 20

注意:请查看 iProgressHUDDemo 以获取详细用法。

MIT 许可

Copyright (c) 2018 Saiful Irham Wicaksana

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.