MKAIndicatorView 2.0.0

MKAIndicatorView 2.0.0

Hituzi Ando 维护。



  • 作者:
  • Hituzi Ando

MKAIndicatorView

MKAIndicatorView 可以让您轻松创建强大的指示器视图。

包含在您的 iOS 应用中

CocoaPods

MKAIndicatorView 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "MKAIndicatorView"

手动安装

  1. 下载最新的 MKAIndicatorView
  2. 将 MKAIndicatorView.framework 拖放到您的 Xcode 项目中

使用方法

  1. 导入模块

    Objective-C

    #import <MKAIndicatorView/MKAIndicatorView.h>

    Swift

    import MKAIndicatorView
  2. 显示指示器

    Objective-C

    [[MKAIndicator basicIndicatorWithActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray]
                   showInView:self.view withTouchDisabled:NO];

    Swift

    MKAIndicator.basicIndicator(with: .gray).show(in: self.view, withTouchDisabled: false)
  3. 隐藏指示器

    Objective-C

    [[MKAIndicator currentIndicator] hide];

    Swift

    MKAIndicator.current().hide()

基本类型

Objective-C

// Show basic indicator.
[[[MKAIndicator basicIndicatorWithActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge]
                addBlackBackgroundView]
                showInView:self.view withTouchDisabled:NO];

Swift

// Show basic indicator.
MKAIndicator.basicIndicator(with: .whiteLarge)
            .addBlackBackgroundView()
            .show(in: self.view, withTouchDisabled: false)

自定义类型

Objective-C

// Show custom indicator.
[[[MKAIndicator customIndicatorWithIndicatorViewImage:[UIImage imageNamed:@"spinner"]]
                setAnimationDuration:1.0]
                showInView:self.view withTouchDisabled:NO];

Swift

// Show custom indicator.
MKAIndicator.customIndicator(withIndicatorViewImage: UIImage(named: "spinner")!)
            .setAnimationDuration(1.0)
            .show(in: self.view, withTouchDisabled: false)

精灵动画类型

Objective-C

// Show sprite animation indicator.
[[[MKAIndicator spriteAnimationIndicatorWithIndicatorViewImagesFormat:@"indicator%zd" count:8]
                setAnimationDuration:.5]
                showInView:self.view withTouchDisabled:NO];

Swift

// Show sprite animation indicator.
MKAIndicator.spriteAnimationIndicator(withIndicatorViewImagesFormat: "indicator%zd", count: 8)
            .setAnimationDuration(0.5)
            .show(in: self.view, withTouchDisabled: false)

仅状态栏类型

Objective-C

// Show indicator on the status bar only.
[[MKAIndicator onlyStatusBarIndicator] showInView:self.view withTouchDisabled:NO];

Swift

// Show indicator on the status bar only.
MKAIndicator.onlyStatusBarIndicator().show(in: self.view, withTouchDisabled: false)

更多信息,请参阅我的示例项目