将 WZSnakeHUD
文件拖入您的项目中。
1. 将以下导入添加到文件顶部:
#import "WZSnakeHUD.h"
2. 使用以下内容显示 HUD:
[WZSnakeHUD show:@"Loading"];
3. 完成任务后简单消失。
[WZSnakeHUD hide];
对于长时间运行的任务,建议将您的内容放在后台队列中,从而解除对用户界面的阻塞,在触发后更新主队列。
[WZSnakeHUD show:@"Loading"];
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// Do your stuff...
dispatch_async(dispatch_get_main_queue(), ^{
[WZSnakeHUD hide];
});
});
随时可以根据需要自定义配置。
背景颜色
[WZSnakeHUD showWithBackgroundColor:[UIColor purpleColor]];
遮罩颜色
[WZSnakeHUD showWithMaskColor:[UIColor colorWithRed:0.0f green:0.0f blue:0.0f alpha:0.5f]];
线宽
[WZSnakeHUD showWithLineWidth:4.5f];
消失动画
[WZSnakeHUD hide];