HUD的各种样式
typedef enum {
MBProgressHUDModeIndeterminate, 默认UIActivityIndicatorView
MBProgressHUDModeDeterminate,
MBProgressHUDModeDeterminateHorizontalBar,
MBProgressHUDModeAnnularDeterminate,
MBProgressHUDModeCustomView,
MBProgressHUDModeText
} MBProgressHUDMode;
// 各种动画效果
typedef enum {
MBProgressHUDAnimationFade,
MBProgressHUDAnimationZoom,
MBProgressHUDAnimationZoomIn
} MBProgressHUDAnimation;
@interface MBProgressHUD : UIView
属性
HUD样式
@property (assign) MBProgressHUDMode mode;
HUD显示和隐藏时的动画样式
@property (assign) MBProgressHUDAnimation animationType;
自定义HUD样式,最好的结果使用37 * 37像素视图(所以边界匹配建立在指标范围内)
@property (MB_STRONG) UIView *customView;
代理对象
@property (MB_WEAK) id<MBProgressHUDDelegate> delegate;
自定义HUD文字
@property (copy) NSString *labelText;
subText
@property (copy) NSString *detailsLabelText;
透明度设置
@property (assign)float opacity;
设置HUD颜色,如果设置颜色,透明度将不能设置
@property (MB_STRONG) UIColor *color;
在父视图x方向的偏移量
@property (assign)float xOffset;
在俯视图y方向的偏移量
@property (assign)float yOffset;
边缘到旋转视图的距离,默认20
@property (assign)float margin;
背景纵向渐变色
@property (assign)BOOL dimBackground;
@property (assign)float graceTime;
@property (assign)float minShowTime;
@property (assign)BOOL taskInProgress;
隐藏时从俯视图删除,默认为no
@property (assign)BOOL removeFromSuperViewOnHide;
mainlabel字体
@property (MB_STRONG) UIFont* labelFont;
sublabel字体
@property (MB_STRONG) UIFont* detailsLabelFont;
进度
@property (assign)float progress;
最小尺寸,默认为0
@property (assign) CGSize minSize;
@property (assign,getter = isSquare) BOOL square;
类方法
创建HUD并添加到View上
+ (MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
找到最顶层的HUD并隐藏
+ (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
找出View上所有HUD子视图,并隐藏
+ (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated;
找到最顶层的HUD,返回
+ (MB_INSTANCETYPE)HUDForView:(UIView *)view;
返回View上所有HUD对象数组
+ (NSArray *)allHUDsForView:(UIView *)view;
对象方法
通过Window初始化HUD
- (id)initWithWindow:(UIWindow *)window;
通过View初始化HUD
- (id)initWithView:(UIView *)view;
- (void)show:(BOOL)animated;
- (void)hide:(BOOL)animated;
- (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;
当一个方法在执行期间,显示HUD
- (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated;
当一个block在执行期间,显示HUD
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block;
当一个block在一个队列上期间,显示HUD
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(MBProgressHUDCompletionBlock)completion;
当一个block在一个调度队列上是,显示HUD
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue;
- (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue
completionBlock:(MBProgressHUDCompletionBlock)completion;
HUD完全隐藏时,调用的block
@property (copy) MBProgressHUDCompletionBlock completionBlock;
属性
HUD样式
@property (assign) MBProgressHUDMode mode;
HUD显示和隐藏时的动画样式
@property (assign) MBProgressHUDAnimation animationType;
自定义HUD样式,最好的结果使用37 * 37像素视图(所以边界匹配建立在指标范围内)
@property (MB_STRONG) UIView *customView;
代理对象
@property (MB_WEAK) id<MBProgressHUDDelegate> delegate;
自定义HUD文字
@property (copy) NSString *labelText;
subText
@property (copy) NSString *detailsLabelText;
透明度设置
@property (assign)float opacity;
设置HUD颜色,如果设置颜色,透明度将不能设置
@property (MB_STRONG) UIColor *color;
在父视图x方向的偏移量
@property (assign)float xOffset;
在俯视图y方向的偏移量
@property (assign)float yOffset;
边缘到旋转视图的距离,默认20
@property (assign)float margin;
背景纵向渐变色
@property (assign)BOOL dimBackground;
@property (assign)float graceTime;
@property (assign)float minShowTime;
@property (assign)BOOL taskInProgress;
隐藏时从俯视图删除,默认为no
@property (assign)BOOL removeFromSuperViewOnHide;
mainlabel字体
@property (MB_STRONG) UIFont* labelFont;
sublabel字体
@property (MB_STRONG) UIFont* detailsLabelFont;
进度
@property (assign)float progress;
最小尺寸,默认为0
@property (assign) CGSize minSize;
@property (assign,getter = isSquare) BOOL square;
完全隐藏时触发此代理方法
- (void)hudWasHidden:(MBProgressHUD *)hud;
@interface MBRoundProgressView : UIView
属性
@property (nonatomic,assign) float progress;
进度条颜色
@property (nonatomic, MB_STRONG) UIColor *progressTintColor;
背景颜色
@property (nonatomic, MB_STRONG) UIColor *backgroundTintColor;
显示样式,圆形或者环形,默认为圆形
@property (nonatomic,assign, getter = isAnnular)BOOL annular;
扁条进度条
@interface MBBarProgressView : UIView
进度
@property (nonatomic,assign) float progress;
线的颜色
@property (nonatomic, MB_STRONG) UIColor *lineColor;
进度条背景颜色,默认clear
@property (nonatomic, MB_STRONG) UIColor *progressRemainingColor;
进度条颜色
@property (nonatomic, MB_STRONG) UIColor *progressColor;