IOS 公共类-MyMBProgressUtil Progress显示
IOS 公共类-MyMBProgressUtil Progress显示
此公共类用于显示提示框,对MBProgress的进一步封装。可以看下面的代码
接口:
@interface MyMBProgressUtil //显示Progress在view上
+(void) showMBProgressHUDViewInView:(UIView*)view andText:(NSString*)text;
//隐藏Progress在view上
+(void) hiddenMBProgressHUDViewInView:(UIView *)view; //显示Progress在window上
+(void) showMBProgressHUDViewInWindow;
//隐藏Progress在window上
+(void) hiddenMBProgressHUDViewInWindow; //显示文字在view上,默认0.8秒后隐藏
+(void) showTextOnlyWithMBProgressHUDViewIn:(UIView*)view withText:(NSString*)text;
//显示文字在view上,自己设定多少秒后隐藏
+(void) showTextOnlyWithMBProgressHUDViewIn:(UIView*)view withText:(NSString*)text withTimeSeconds:(CGFloat)seconds;
//显示详细文字在view上,自己设定多少秒后隐藏
+(void) showTextOnlyWithMBProgressHUDViewIn:(UIView*)view withDetailText:(NSString*)detailText withTimeSeconds:(CGFloat)seconds; @end
实现类:
@implementation MyMBProgressUtil: NSObject
+(void) showMBProgressHUDViewInView:(UIView*)view andText:(NSString*)text {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.clipsToBounds = NO;
[hud setLabelText:text];
hud.removeFromSuperViewOnHide = YES;
hud.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.3f];
CGRect frame = CGRectMake(hud.frame.origin.x, hud.frame.origin.y, hud.frame.size.width-, hud.frame.size.height-);
hud.frame = frame;
}
+(void)hiddenMBProgressHUDViewInView:(UIView *)view {
[MBProgressHUD hideHUDForView:view animated:YES];
}
+(void) showMBProgressHUDViewInWindow {
UIWindow *win = [UIApplication sharedApplication].keyWindow;
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithWindow:win];
hud.backgroundColor = [[UIColor grayColor] colorWithAlphaComponent:0.3f];
hud.mode = MBProgressHUDModeIndeterminate;
hud.removeFromSuperViewOnHide = YES;
[win addSubview:hud];
[hud show:YES];
}
+(void) hiddenMBProgressHUDViewInWindow {
UIWindow *win = [UIApplication sharedApplication].keyWindow;
[MBProgressHUD hideHUDForView:win animated:YES];
}
+(void) showTextOnlyWithMBProgressHUDViewIn:(UIView*)view withText:(NSString*)text{
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.labelText = text;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:0.8f];
}
+(void) showTextOnlyWithMBProgressHUDViewIn:(UIView*)view withText:(NSString*)text withTimeSeconds:(CGFloat)seconds {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.labelText = text;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:seconds];
}
+(void) showTextOnlyWithMBProgressHUDViewIn:(UIView*)view withDetailText:(NSString*)detailText withTimeSeconds:(CGFloat)seconds {
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
hud.mode = MBProgressHUDModeText;
hud.detailsLabelText = detailText;
hud.removeFromSuperViewOnHide = YES;
[hud hide:YES afterDelay:seconds];
}
@end
可以下载通过github:https://github.com/cjt321/MyMBProgressUtil
IOS 公共类-MyMBProgressUtil Progress显示的更多相关文章
- IOS 公共类-MyDateUtil 日期处理Util
IOS 公共类-MyDateUtil 日期处理Util 此为处理日期的公共类.适用IOS6+ .h文件: #import <Foundation/Foundation.h> //适用 IO ...
- IOS 公共类-数字处理
1.写一个方法,调用的时候交换两个数的值 -(void) swap:(int*)a andNumber:(int*)b{ int temp = *a; *a = *b; *b = temp; } 调用 ...
- Mybatis包分页查询java公共类
Mybatis包分页查询java公共类 分页----对于数据量非常大的查询中.是不可缺少的. mybatis底层的分页sql语句因为须要我们自己去手动写.而实现分页显示的时候我们须要依据分页查询条 ...
- iOS开发-类簇(Class Cluster)
类簇(Class Cluster)是定义相同的接口并提供相同功能的一组类的集合,仅公开接口的抽象类也可以称之为类簇的公共类,每个具体类的接口有公共类的接口抽象化,并隐藏在簇的内部.这些类一般不能够直 ...
- 一个Java文件至多包含一个公共类
编写一个java源文件时,该源文件又称为编译单元.一个java文件可以包含多个类,但至多包含一个公共类,作为编译时该java文件的公用接口,公共类的名字和源文件的名字要相同,源文件名字的格式为[公共类 ...
- ASP.NET中常用的几个李天平开源公共类LTP.Common,Maticsoft.DBUtility,LtpPageControl
ASP.NET中常用的几个开源公共类: LTP.Common.dll: 通用函数类库 源码下载Maticsoft.DBUtility.dll 数据访问类库组件 源码下载LtpPageC ...
- Java ClassLoader基础及加载不同依赖 Jar 中的公共类
转载自:最新内容及最清晰格式请见 http://www.trinea.cn/android/java-loader-common-class/ 本文主要介绍 ClassLoader 的基础知识,Cla ...
- ASP.NET中常用的几个李天平开源公共类LTP.Common,Maticsoft.DBUtility,LtpPageControl (转)
ASP.NET中常用的几个开源公共类: LTP.Common.dll: 通用函数类库 源码下载Maticsoft.DBUtility.dll 数据访问类库组件 源码下载LtpPageC ...
- 一位iOS教育类应用开发者是如何赚到60多万美元?
注:伯乐在线12月19日在@程序员的那些事 微博推荐了此文的英文原文,非常感谢@dotSlash 的翻译. 转眼距我写<我如何在iOS教育类应用中赚到20万美元>这篇博文已经一年多了,它 ...
随机推荐
- maven认证信息
上传至本地文件夹 <distributionManagement> <repository> <id>test</id ...
- Oracle 11g 导库导不出空表问题
Oracle11g 会遇到这样的问题,用exp整库导出的时候,会遇到这样的问题,库里的空表没办法导出 select * from all_all_tables aa where aa.owner='U ...
- sharepoint 网站创建
打开开始菜单,右键sharepoint管理中心以管理员身份打开 打开管理web应用程序菜单,并新建web应用程序 新建web应用程序配置,大多数采用默认配置. 建议自定义端口号,URL的端口号和设置的 ...
- java获取文件名的三种方法
import java.io.File; import java.util.Arrays; public class FileName { /** * @param args */ public st ...
- 杨光福IT讲师微博
杨光福IT讲师微博: http://weibo.com/321chinavideo 微博现在里面有很多干货,以后会越来越多,主要用于分享和交流技术.关注一下对你有帮助.
- linux-15基础命令之-用户与用户组(useradd,userdel,usermod,passwd,groupadd)
1.useradd 命令用于创建新的用户,格式为:useradd[选项] 用户名 useradd参数 参数 作用 -d 指定用户的家目录(默认/home/username) -D 展示默认值 -e 帐 ...
- C++混合编程之idlcpp教程Python篇(5)
上一篇在这 C++混合编程之idlcpp教程Python篇(4) 第一篇在这 C++混合编程之idlcpp教程(一) 与前面的工程相似,工程PythonTutorial3中,同样加入了三个文件:Py ...
- Knockoutjs 实践入门 (2) 绑定事件
Knockoutjs 绑定事件 Knockoutjs 不仅支持UI 元素的属性绑定到model的属性,还支持UI 元素的事件绑定model的事件. 需求: l click me button 每单击 ...
- Rubinius 2.0 发布,Ruby 虚拟机
Rubinius 2.0 发布了,官方发行说明请看这里. Rubinius是一个运行Ruby程序的虚拟机,其带有Ruby的核心库. Rubinius的设计决定了其调试功能的强大,使得在运行时常规的Ru ...
- 【菜鸟玩Linux开发】在C++里操作MySQL
MySQL是一个的开源关系型数据库,对于服务端开发来说是一个优秀的选择.本篇内容将介绍如何在C++程序里操作MySQL数据库. ———————————————————————————————————— ...