LoadingView.h
#import <Foundation/Foundation.h>
@class MBProgressHUD; @interface LoadingView : NSObject @property (nonatomic, retain) MBProgressHUD *HUD; + (LoadingView *)sharedInstance; /**
* 加载中提示框
*
* @param title 标题
* @param superView 父View
*/
- (void)showLoadingViewWithTitle:(NSString *)title superView:(UIView *)superView; /**
* 加载中提示框
*
* @param title 标题
* @param delay 关闭时间
* @param superView 父View
*/
- (void)showLoadingViewWithTitle:(NSString *)title afterDelay:(NSTimeInterval)delay superView:(UIView *)superView; /**
* 关闭提示框
*/
- (void)closeLoadingView; @end LoadingView.m
#import "LoadingView.h"
#import "MBProgressHUD.h" @implementation LoadingView @synthesize HUD; static LoadingView *_shardLoadingView = nil; + (LoadingView *)sharedInstance
{
if (_shardLoadingView == nil) {
_shardLoadingView = [[LoadingView alloc]init];
}
return _shardLoadingView;
} - (id)init
{
self = [super init];
if (self) {
HUD = [[MBProgressHUD alloc] init];
}
return self;
} - (void)showLoadingViewWithTitle:(NSString *)title superView:(UIView *)superView
{
HUD.labelText = title;
[superView addSubview:HUD];
[superView bringSubviewToFront:HUD];
[HUD show:YES]; } - (void)showLoadingViewWithTitle:(NSString *)title afterDelay:(NSTimeInterval)delay superView:(UIView *)superView
{
HUD.labelText = title;
[superView addSubview:HUD];
[superView bringSubviewToFront:HUD];
[HUD show:YES]; [HUD hide:YES afterDelay:delay];
} - (void)closeLoadingView
{
[HUD hide:YES];
} @end // 使用
[[LoadingView sharedInstance]showLoadingViewWithTitle:@"加载中...." superView:self.view];

IOS 加载中提示框的更多相关文章

  1. jquery mobile 请求数据方法执行时显示加载中提示框

    在jquery mobile开发中,经常需要调用ajax方法,异步获取数据,如果异步获取数据方法由于网速等等的原因,会有一个反应时间,如果能在点击按钮后数据处理期间,给一个正在加载的提示,客户体验会更 ...

  2. 微信小程序之----加载中提示框loading

    loading loading只有一个属性hidden .wxml <view> <loading hidden="{{hidden}}"> 加载中... ...

  3. [转]jquery的ajax交付时“加载中”提示的处理方法

    本文转自:http://www.educity.cn/wenda/77121.html jquery的ajax提交时“加载中”提示的处理方法    方法1:使用ajaxStart方法定义一个全局的“加 ...

  4. jquery的ajax提交时“加载中”提示的处理方法

    方法1:使用ajaxStart方法定义一个全局的“加载中...”提示 $(function(){    $("#loading").ajaxStart(function(){    ...

  5. iOS -iOS9中提示框(UIAlertController)的常见使用

    iOS 8 之前提示框主要使用 UIAlertView和UIActionSheet:iOS 9 将UIAlertView和UIActionSheet合二为一为:UIAlertController . ...

  6. JQuery插件:遮罩+数据加载中。。。(特点:遮你想遮,罩你想罩)

    在很多项目中都会涉及到数据加载.数据加载有时可能会是2-3秒,为了给一个友好的提示,一般都会给一个[数据加载中...]的提示.今天就做了一个这样的提示框. 先去jQuery官网看看怎么写jQuery插 ...

  7. js中提示框闪退问题

    当页面存在刷新  或  在线引用iframe框架时(引用框架也会导致刷新) 会导致页面加载时的弹出框闪退 解决方法:设置弹出框在页面或者框架完全加载一段时间后再弹出 <script type=& ...

  8. jQuery Mobile 手动显示ajax加载器,提示加载中...

    在使用jQuery Mobile开发时,有时候我们需要在请求ajax期间,显示加载提示框(例如:一个旋转图片+一个提示:加载中...).这个时候,我们可以手动显示jQuery Mobile的加载器,大 ...

  9. ASP.NET中页面加载时文本框(texbox控件)内有文字获得焦点时文字消失

    代码如下: <asp:TextBox ID="TextBox1" runat="server" Height="26px" MaxLe ...

随机推荐

  1. base64转码

    Base64是一种编码方法,可以将任意字符转成可打印字符.使用这种编码方法,主要不是为了加密,而是为了不出现特殊字符,简化程序的处理. JavaScript原生提供两个Base64相关方法. btoa ...

  2. K贪心

    <span style="color:#330099;">/* K - 贪心 基础 Time Limit:1000MS Memory Limit:32768KB 64b ...

  3. ASP.NET MVC 阻止当前请求的视图页面缓存OutputCache

    设置缓存 [OutputCache(Duration =333,VaryByCustom ="Index")] 缓存: //在action中,临时阻止该次请求的视图页面缓存 Res ...

  4. HTML5 本地裁剪图片并上传至服务器(转)

    很多情况下用户上传的图片都需要经过裁剪,比如头像啊什么的.但以前实现这类需求都很复杂,往往需要先把图片上传到服务器,然后返回给用户,让用户确定裁剪坐标,发送给服务器,服务器裁剪完再返回给用户,来回需要 ...

  5. Android界面优化方法

    我们在推出一款APP之后,中间出现了一些体验上的问题,一个明显的是界面卡顿,针对此问题我们采取了如下的一些措施,起到了一些效果. 1.优化界面层次 针对可以合并的界面层次进行合并,减少界面的渲染,这个 ...

  6. Ubuntu14.10下解决chromium浏览器无法安装adobe flash的问题

    本文参考了一下资源和博客,在此提出表示感谢: http://my.oschina.net/u/209016/blog/290067 http://ubuntuhandbook.org/index.ph ...

  7. (原+转)pycharm中传入命令行参数

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5670821.html 参考网址: http://zhidao.baidu.com/question/5 ...

  8. HttpURLConnection详解

    HttpURLConnection详解 07. 五 / J2EE / 没有评论   HttpURLConnection类的作用是通过HTTP协议向服务器发送请求,并可以获取服务器发回的数据. Http ...

  9. 阿里巴巴JAVA常考面试题及汇总答案

    一.String,StringBuffer, StringBuilder 的区别是什么?String为什么是不可变的? 答:   1.String是字符串常量,StringBuffer和StringB ...

  10. 使用ARM模板部署自动扩展的Linux VMSS(2)

    12.准备完了模板文件,我们使用Powershell来创建VMSS for Linux的自动扩展集合,首先登陆到Azure中国的ARM账号: Login-AzureRmAccount -Environ ...