github:https://github.com/TransitApp/SVProgressHUD
github下载的资源中有详细的使用方法。完全可以自定义包括后置背景颜色、前置颜色、字体的
大小、成功时的图片、错误时的图片、信息图片等,很好用。
从效果来看SVProgresssHUD 使用了单例的方法,自定义属性之后,所有的显示风格都是之前自定义的。
以下几乎全是从demo中抄来的…..
-(IBAction)dismissSV :(id)sender
{
[SVProgressHUD dismiss];
}
-(IBAction)showWithStatus :(id)sender
{
// SVProgressHUDMaskTypeNone = 1, // allow user interactions while HUD is displayed
// SVProgressHUDMaskTypeClear, // don't allow user interactions
// SVProgressHUDMaskTypeBlack, // don't allow user interactions and dim the UI in the back of the HUD
// SVProgressHUDMaskTypeGradient
[SVProgressHUD showWithStatus:@"玩命加载中..." maskType:SVProgressHUDMaskTypeBlack];
[self performSelector:@selector(dismissSV:) withObject:nil afterDelay:0.5f];
}
static float progress = 0.0f;
-(IBAction)showWithProgress :(id)sender
{
progress=0.0f;
[SVProgressHUD showProgress:progress status:@"加载中" maskType:SVProgressHUDMaskTypeBlack];
}
- (void)increaseProgress {
progress+=0.1f;
[SVProgressHUD showProgress:progress status:@"Loading"];
if(progress < 1.0f)
[self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3f];
else
[self performSelector:@selector(dismiss) withObject:nil afterDelay:0.4f];
}
-(IBAction)showSV :(id)sender
{
[SVProgressHUD show];
[self performSelector:@selector(dismissSV:) withObject:nil afterDelay:0.5f];
}
-(IBAction)showInfoWithStatus :(id)sender
{
[SVProgressHUD setBackgroundColor:[UIColor greenColor]];
[SVProgressHUD setForegroundColor:[UIColor orangeColor]];
[SVProgressHUD setCornerRadius:5];
[SVProgressHUD showInfoWithStatus:@"Useful Information" maskType:SVProgressHUDMaskTypeClear];
[self performSelector:@selector(dismissSV:) withObject:nil afterDelay:0.5f];
}
-(IBAction)showSuccessWithStatus:(id)sender
{
[SVProgressHUD showSuccessWithStatus:@"Great Success!" maskType:SVProgressHUDMaskTypeGradient];
[self performSelector:@selector(dismissSV:) withObject:nil afterDelay:0.5f];
}
-(IBAction)showErrorWithStatus:(id)sender
{
[SVProgressHUD showErrorWithStatus:@"出错了" maskType:SVProgressHUDMaskTypeClear];
[self performSelector:@selector(dismissSV:) withObject:nil afterDelay:0.5f];
}