SVProgressHUD 用法
SVProgressHUD 是一个第三方的控件,是一个弹出提示层,用来提示 网络加载 或 提示对错,看下面图,你就明白了:
那么,SVProgressHUD 都有什么特点呢:
1. 提示当前的状态,如:网络传输、提交中、操作成功或失败等等.
2. 可是设置提示的 pop layer 是否为 model,就是,提示的时间是否允许用户做其他操作
3. 可以设置 背景色 和 自定义提示的内容
4. 使用起来非常简洁,代码量非常少
那么如何使用 SVProgressHUD 呢:
1. 官网下载代码,并放入到项目中
2. 在使用到的 项目 里面,加入引用 #import "SVProgressHUD.h"
3. 在需要提示的地方,加入调用代码 ,如:
[SVProgressHUD showWithStatus:@"加载中..." maskType:SVProgressHUDMaskTypeGradient]
4. 在需要隐藏的地方,加入隐藏当前提示的代码,如:[SVProgressHUD dismiss]
SVProgressHUD 常用方法介绍:
1. + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType 调用 SVProgressHUD,并自定义 提示的内容 和 提示层的样式
2. + (void)dismiss 关闭当前提示
SVProgressHUDMaskType 介绍:
1. SVProgressHUDMaskTypeNone : 当提示显示的时间,用户仍然可以做其他操作,比如View 上面的输入等
2. SVProgressHUDMaskTypeClear : 用户不可以做其他操作
3. SVProgressHUDMaskTypeBlack : 用户不可以做其他操作,并且背景色是黑色
4. SVProgressHUDMaskTypeGradient : 用户不可以做其他操作,并且背景色是渐变的
SVProgressHUD 全部方法:
+ (void)show; + (void)showWithStatus:(NSString*)status; + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; + (void)showSuccessWithStatus:(NSString*)string; + (void)showSuccessWithStatus:(NSString *)string duration:(NSTimeInterval)duration; + (void)showErrorWithStatus:(NSString *)string; + (void)showErrorWithStatus:(NSString *)string duration:(NSTimeInterval)duration; + (void)setStatus:(NSString*)string; // change the HUD loading status while it's showing + (void)dismiss; // simply dismiss the HUD with a fade+scale out animation + (void)dismissWithSuccess:(NSString*)successString; // also displays the success icon image + (void)dismissWithSuccess:(NSString*)successString afterDelay:(NSTimeInterval)seconds; + (void)dismissWithError:(NSString*)errorString; // also displays the error icon image + (void)dismissWithError:(NSString*)errorString afterDelay:(NSTimeInterval)seconds; + (BOOL)isVisible;
本文禁止任何网站转载,严厉谴责那些蛀虫们。
本文首发于,博客园,请搜索:博客园 - 寻自己,查看原版文章
本文首发地址:http://www.cnblogs.com/xunziji/archive/2012/11/05/2754915.html - SVProgressHUD 用法
本文首发于,博客园,请搜索:博客园 - 寻自己,查看原版文章
本文首发地址:http://www.cnblogs.com/xunziji/archive/2012/11/05/2754915.html - SVProgressHUD 用法
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义