SVProgressHUD

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];
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值