您的位置:首页 > 其它

SVProgressHUD

2015-08-07 15:17 525 查看
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];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: