基本属性
// 文本框和其相关属性
@property (copy) NSString *labelText;
@property (MB_STRONG) UIFont* labelFont;
@property (MB_STRONG) UIColor* labelColor;
//详情文本框和其相关属性
@property (copy) NSString *detailsLabelText;
@property (MB_STRONG) UIFont* detailsLabelFont;
@property (MB_STRONG) UIColor* detailsLabelColor;
// 背景框的透明度,默认值是0.8
@property (assign) float opacity;
// 背景框的颜色, 如果设置了这个属性,则opacity属性会失效,即不会有半透明效果
@property (MB_STRONG) UIColor *color;
// 背景框的圆角半径。默认值是10.0
@property (assign) float cornerRadius;
// 菊花的颜色,默认是白色
@property (MB_STRONG) UIColor *activityIndicatorColor;
模式
typedef enum {
/** 默认模式,使用系统自带的指示器 ,不能显示进度,只能不停地转呀转*/
MBProgressHUDModeIndeterminate,
/** 用饼图显示进度 */
MBProgressHUDModeDeterminate,
/** 进度条 */
MBProgressHUDModeDeterminateHorizontalBar,
/** 圆环 */
MBProgressHUDModeAnnularDeterminate,
/** 自定义视图 */
MBProgressHUDModeCustomView,
/** 只显示文字 */
MBProgressHUDModeText
} MBProgressHUDMode;
#pragma mark -- HUD
-(void)initProgressHUD
{
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.delegate = self;
HUD.dimBackground = YES; // 蒙版背景
// HUD.alpha = 0.0;
// HUD.color = [UIColor clearColor]; // 转动的菊花 所在的方框的背景
HUD.activityIndicatorColor = [UIColor lightGrayColor];
}
参考来源:http://www.jianshu.com/p/485b8d75ccd4
2
MBProgressHUD * HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"m_clear"]];
// Set custom view mode
**小框背景颜色设置
HUD.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
HUD.bezelView.backgroundColor = [UIColor clearColor];
/**/ 整体遮罩背景颜色
HUD.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:.6f];
**自定义
HUD.mode = MBProgressHUDModeCustomView;
[HUD showAnimated:YES];
[HUD hideAnimated:YES afterDelay:1];
设置-清除.jpg
网友评论