BBALoadIndicatorView.h 1.96 KB
//
//  BBALoadIndicatorView.h
//  BBAUIKit
//
//  Created by zhangyunchao on 2020/8/8.
//  Copyright © 2020 Baidu. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, BBALoadIndicatorType) {
    BBALoadIndicatorTypeDefault, // 默认,不阻塞用户操作
    BBALoadIndicatorTypeModal,   // modal,阻塞用户操作当前页面
};

@interface BBALoadIndicatorView : UIView

/// 加载指示,默认不带按钮,不阻塞交互
+ (void)showLoading:(NSString *)message;


/// 加载指示,不带关闭按钮,交互类型可配置
/// @param message 文本
/// @param type 交互类型,区分是否阻塞用户操作
+ (void)showLoading:(NSString *)message
        loadingType:(BBALoadIndicatorType)type;


/// 加载指示,按钮及交互类型可配置
/// @param message 提示文案
/// @param type 交互类型
/// @param callback 关闭按钮点击回调,callback传入为nil则不展示关闭按钮,否则展示
+ (void)showLoading:(NSString *)message
        loadingType:(BBALoadIndicatorType)type
           callback:(nullable dispatch_block_t)callback;


/// 加载指示,按钮及交互类型可配置,父view可配置
/// @param message 提示文案
/// @param type 交互类型
/// @param hostView 指定加载父View
/// @param callback 关闭按钮点击回调,callback传入为nil则不展示关闭按钮,否则展示
+ (void)showLoading:(NSString *)message
        loadingType:(BBALoadIndicatorType)type
           hostView:(nullable UIView *)hostView
           callback:(nullable dispatch_block_t)callback;

/// 在指定 darkmode模式下执行
/// @param mode darkmode标识,设置为nil则无效,内部按照当前mode适配
/// @param taskBlock toast任务block
+ (void)runInMode:(nullable NSString *)mode
         withTask:(dispatch_block_t)taskBlock;


/// 判定当前加载指示是否正在展示中
+ (BOOL)isIndicatorOnShowing;

/// 隐藏加载
+ (void)hideLoadIndicator;

@end

NS_ASSUME_NONNULL_END