MBProgressHUD

11st,September,2016
Version 1.0.0
github地址

MBProgressHUD is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD with some additional features.
一款显示半透明HUD的第三方框架.UIKit有个私有的UIProgressHUD也是实现了类似的功能,但没有开放给开发者。

r: 跟去年使用的时候调整了蛮多;

使用

初始化

- (instancetype)initWithView:(UIView *)view;
+ (instancetype)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;// create and display the HUD

显示HUD

+ (instancetype)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;// create and display the HUD
- (void)showAnimated:(BOOL)animated;// display the HUD

隐藏HUD

+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
- (void)hideAnimated:(BOOL)animated;
- (void)hideAnimated:(BOOL)animated afterDelay:(NSTimeInterval)delay;

Config

基本结构

由指示器(indicatorView),文本框(label),详情文本框(detailLabel),挡板(bezelView),按钮等组成.

@interface MBProgressHUD : UIView
    @property (strong, nonatomic, readonly) UILabel *label;
    @property (strong, nonatomic, readonly) UILabel *detailsLabel;
    @property (strong, nonatomic, readonly) MBBackgroundView *bezelView;
    /**
     * A button that is placed below the labels. Visible only if a target / action is added. 
     */
    @property (strong, nonatomic, readonly) UIButton *button;
@end
MBProgressHUDMode
@interface MBProgressHUD : UIView
    @property (assign, nonatomic) MBProgressHUDMode mode;
@end

typedef NS_ENUM(NSInteger, MBProgressHUDMode) {
    /// UIActivityIndicatorView.Default value
    MBProgressHUDModeIndeterminate,
    /// A round, pie-chart like, progress view.
    MBProgressHUDModeDeterminate,
    /// Horizontal progress bar.
    MBProgressHUDModeDeterminateHorizontalBar,
    /// Ring-shaped progress view.
    MBProgressHUDModeAnnularDeterminate,
    /// Shows a custom view.
    MBProgressHUDModeCustomView,
    /// Shows only labels.
    MBProgressHUDModeText
};

MBProgressHUDModeIndeterminate // 使用UIActivityIndicatorView
MBProgressHUDModeIndeterminate
MBProgressHUDModeDeterminate // 使用圆形饼图显示进度
MBProgressHUDModeDeterminate
MBProgressHUDModeDeterminateHorizontalBar // 水平进度加载条
MBProgressHUDModeDeterminateHorizontalBar
MBProgressHUDModeAnnularDeterminate // 使用圆环加载条
MBProgressHUDModeAnnularDeterminate
MBProgressHUDModeCustomView // 显示自定义视图,下图为默认自定义视图
这里写图片描述
MBProgressHUDModeText // 只显示文本
这里写图片描述

ps: 打雷了,感觉快要下雨了,我还是赶紧回去了

参考资料

源码笔记—MBProgressHUD

源码篇:MBProgressHUD
iOS 源代码分析 — MBProgressHUD

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值