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. pyqt MainWindow记录内容

    class Texts(QtGui.QMainWindow,Ui_MainWindow): def __init__(self,parne=None): super(Texts,self).__ini ...

  2. KVO奥秘

    序言 在iOS开发中,苹果提供了许多机制给我们进行回调.KVO(key-value-observing)是一种十分有趣的回调机制,在某个对象注册监听者后,在被监听的对象发生改变时,对象会发送一个通知给 ...

  3. Working with Numbers in PL/SQL(在PL/SQL中使用数字)

    This article gives you all the information you need in order to begin working with numbers in your P ...

  4. 用cflow工具生成代码函数调用关系

    1. 安装 sudo apt-get install cflow 2.使用 cflow [options...] [file]... 例: cflow main.c 生成main.c文件例的函数调用关 ...

  5. C# using垃圾回收详解

    简介 定义一个范围,将在此范围之外释放一个或多个对象. 语法 using (Font font1 = new Font("Arial", 10.0f)) { } C# 语言参考 主 ...

  6. Spark集群搭建简要

    Spark集群搭建 1 Spark编译 1.1 下载源代码 git clone git://github.com/apache/spark.git -b branch-1.6 1.2 修改pom文件 ...

  7. CDZSC_2015寒假新人(1)——基础 g

    Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...

  8. imadjust函数分析一

    声明:本文涉及到的行数皆指本文提供的附件imadjust.m的代码中行数 本文只讨论imadjust函数是一种用法,即 J = IMADJUST(I,[LOW_IN; HIGH_IN],[LOW_OU ...

  9. Java的反射机制及应用实例

    一:什么是反射机制 简单的来说,反射机制指的是程序在运行时能够获取自身的信息.在Java中,只要给定类的名字,那么就可以通过反射机制来获得类的所有信息. 二:哪里用到反射机制 我们用过一些知识,但是并 ...

  10. ActionSupport.getText()方法 以及 js中:<s:text name="" />

    下面略述com.opensymphony.xwork2.ActionSupport.getText()方法 public String getText(String aTextName) 说明:Get ...