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万美元>这篇博文已经一年多了,它 ...
随机推荐
- c# 调用 matlab
如果本机没有安装Matlab 需要安装一个叫 MCRInstaller 的东西 运行环境 如果安装后 需要把D:\MATLAB\R2013a\bin\win64; 写入环境变量 (路径根据实际情况改 ...
- paip.语义分析--分词--常见的单音节字词 2_deDuli 单字词 774个
paip.语义分析--分词--常见的单音节字词 2_deDuli 单字词 774个 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专栏 地址 ...
- HTML流动布局各种宽度自适应
<!DOCTYPE html> <html lang="en"> <style> html,body{ padding: 0;margin: 0 ...
- 移动端字体缩放问题解决方案-摘自《html5移动web开发实践》
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name ...
- iOS-三方框架AFNetworking基本使用
AFNetworking 是基于NSURLConnection, NSOperation开发的一款三方框架,主要用于处理一些关于网络请求上的业务,下文会简单介绍框架中经常使用的功能,如文件的上传,下载 ...
- jquery 监听input输入值事件
<html> <head> <title></title> <script type="text/javascript" sr ...
- c++中的指针之指针在数组
使用一维指针数组输出一维数组中的数 int array[]={1,2,3,4,5,6}; int *p; p=array; for(int i=0;i<6;i++){ ...
- jqm页面跳转问题
jqm里面页面跳转默认都是通过ajax请求的,必须重新刷新页面js方可有效,也就是js没有起作用,并不是js本身的问题,下面说说解决方法: 在使用jQuery Mobile进行Web开发中,当页面跳转 ...
- code review
代码审核,开发者代码完工,就可以下一个环节,即代码审核,通过代码审核,可以看到多个开发者的代码规范,隐藏的BUG,一些注释等规范. 通过代码审核,我们开发者可以互相学习,使得代码逻辑正确,重用
- 解剖SQLSERVER 第二篇 对数据页面头进行逆向(译)
解剖SQLSERVER 第二篇 对数据页面头进行逆向(译) http://improve.dk/reverse-engineering-sql-server-page-headers/ 在开发Orc ...