A clean and multithreading progress HUD for your iOS
A clean and multithreading progress HUD for your iOS
#import "XYProgressHUD.h"
###只显示一个HUD(单例)
#####提示:单例用于显示单个HUD的场景,如果多个HUD同时显示,会起冲突
[XYProgressHUD showStatus:@""];
[XYProgressHUD showStatus:@"" duration:duration];
[XYProgressHUD showLoadingWithDuration: duration];
[XYProgressHUD showLoadingWithDuration: duration status:@""];
[XYProgressHUD showLoadingIndefinitely];
[XYProgressHUD showLoadingIndefinitelyWithStatus:@""];
[XYProgressHUD dismissLoading];
[XYProgressHUD dismissLoadingWithDelay:duration];
###只显示一个HUD(非单例)
#####提示:非单例用于依次显示多个HUD的场景,采用FIFO(先进先出)策略
[[XYProgressHUD initHUD] fifo_showStatus:@""];
[[XYProgressHUD initHUD] fifo_showStatus:@"" duration:duration];
[[XYProgressHUD initHUD] fifo_showLoadingWithDuration:duration];
[[XYProgressHUD initHUD] fifo_showLoadingWithDuration:duration status:@""];
###同时显示多个HUD(非单例)
XYProgressHUD *hud_1 = [XYProgressHUD initHUD];
[hud_1 fifo_showStatus:@"" duration:duration];
XYProgressHUD *hud_2 = [XYProgressHUD initHUD];
[hud_2 fifo_showStatus:@"" duration:duration];
XYProgressHUD *hud_1 = [XYProgressHUD initHUD];
[hud_1 fifo_showLoadingWithDuration:duration];
XYProgressHUD *hud_2 = [XYProgressHUD initHUD];
[hud_2 fifo_showStatus:@"" duration:duration];
XYProgressHUD *hud_1 = [XYProgressHUD initHUD];
[hud_1 fifo_showLoadingWithDuration:duration];
XYProgressHUD *hud_2 = [XYProgressHUD initHUD];
[hud_2 fifo_showLoadingWithDuration:duration];
XYProgressHUD *hud_1 = [XYProgressHUD initHUD];
[hud_1 fifo_showLoadingWithDuration:duration status:@""];
XYProgressHUD *hud_2 = [XYProgressHUD initHUD];
[hud_2 fifo_showStatus:@"" duration:duration];
##提示
###如何替换加载动画图片
直接修改Resources文件夹里的图片文件即可
###如何只设置一次属性 后面使用的时候就不用设置
直接用单例实现,比如:
[XYProgressHUD setDefaultStyle:XYProgressHUDStyleCustom];
[XYProgressHUD setFont:[UIFont systemFontOfSize:11]];//字体大小
[XYProgressHUD setForegroundColor:[UIColor blueColor]];//字体颜色,字体颜色必须设置DefaultStyle为XYProgressHUDStyleCustom
[XYProgressHUD showStatus:@"Hello"];
##后期会做
//1.默认配置
XYProgressHUDConfiguration *config = [XYProgressHUDConfiguration defaultConfiguration];
//2.自定义配置
XYProgressHUDConfiguration *config = [XYProgressHUDConfiguration configuration];
[config setDefaultStyle:XYProgressHUDStyleCustom];
[config setFont:[UIFont systemFontOfSize:11]];//字体大小
[config setForegroundColor:[UIColor blueColor]];
[[XYProgressHUD HUDWithConfig:config] fifo_showLoadingWithDuration:duration]