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
MBProgressHUDModeDeterminate // 使用圆形饼图显示进度
MBProgressHUDModeDeterminateHorizontalBar // 水平进度加载条
MBProgressHUDModeAnnularDeterminate // 使用圆环加载条
MBProgressHUDModeCustomView // 显示自定义视图,下图为默认自定义视图
MBProgressHUDModeText // 只显示文本
ps: 打雷了,感觉快要下雨了,我还是赶紧回去了