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万美元>这篇博文已经一年多了,它 ...
随机推荐
- layout优化实践
昨天确定了启动时,inflate耗时太多,当时不知道怎么回事,去Trinea的博客一逛,发现原来是需要进行layout优化,跟着他们的步伐,做了下面的修改. 1.据说在lint前是一款layout工具 ...
- linux下svn常用命令
(如果是第一次提交文件,很可能会出现“svn:'.'不是工作副本”,即当前目录不是工作副本,这个时候需要用到import: eg:svn import . url) 1.将文件checkout到本地目 ...
- 1260: [CQOI2007]涂色paint
Description 假设你有一条长度为5的木版,初始时没有涂过任何颜色.你希望把它的5个单位长度分别涂上红.绿.蓝.绿.红色,用一个长度为5的字符串表示这个目标:RGBGR. 每次你可以把一段连续 ...
- $(function(){})、$(document).ready(function(){})....../ ready和onload的区别
1.window.onload 当一个文档完全下载到浏览器中时,会触发 window.onload 事件. 这意味着页面上的全部元素对 javascript 而言都是可以访问的,这种情况对编写功能性的 ...
- JavaScript-计算器
事件周期 DOM:3个阶段 1.捕获:从最外层元素,向内层元素,逐个记录绑定的事件处理函数.默认,暂不触发任何事件 2.目标触发:优先触发目标元素绑定的事件处理函数 目标元素:实际点击的元素 3.冒泡 ...
- ASP.NET MVC 部署全站HTTPS
什么是全站HTTPS 全站HTTPS就是指整个网站的所有页面,所有资源全部使用HTTPS链接. 当用户的某个请求是明文的HTTP时,应该通过HTTP状态码301永久重定向到对应的HTTPS链接. 为了 ...
- GERBER文件
GERBER文件 GERBER文件是一种国际标准的光绘格式文件,它包含RS-274-D和RS-274-X两种格式,其中RS-274-D称为基本GERBER格式,并 要同时附带D码文件才能完整描述一张图 ...
- 原声JavaScript实现滚动条·改1
修正了获取元素相对视口左距离的逻辑问题(之前的函数实际获取的是相对于页面左距离).去除了调试时忘记删除的mouseleave事件.将创建滚动条的功能单独列为一个函数. 添加了鼠标点在滚动条什么位置,就 ...
- 【Android UI】Android ListView详解
在android开发中ListView是比较常用的组件,它以列表的形式展示具体内容,并且能够根据数据的长度自适应显示.抽空把对ListView的使用做了整理,并写了个小例子,如下图. 列表的显示需要三 ...
- php-empty()
$arr = array(array(),array()); 原来empty($arr)值为true哦