IOS 加载中提示框
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 加载中提示框的更多相关文章
- jquery mobile 请求数据方法执行时显示加载中提示框
在jquery mobile开发中,经常需要调用ajax方法,异步获取数据,如果异步获取数据方法由于网速等等的原因,会有一个反应时间,如果能在点击按钮后数据处理期间,给一个正在加载的提示,客户体验会更 ...
- 微信小程序之----加载中提示框loading
loading loading只有一个属性hidden .wxml <view> <loading hidden="{{hidden}}"> 加载中... ...
- [转]jquery的ajax交付时“加载中”提示的处理方法
本文转自:http://www.educity.cn/wenda/77121.html jquery的ajax提交时“加载中”提示的处理方法 方法1:使用ajaxStart方法定义一个全局的“加 ...
- jquery的ajax提交时“加载中”提示的处理方法
方法1:使用ajaxStart方法定义一个全局的“加载中...”提示 $(function(){ $("#loading").ajaxStart(function(){ ...
- iOS -iOS9中提示框(UIAlertController)的常见使用
iOS 8 之前提示框主要使用 UIAlertView和UIActionSheet:iOS 9 将UIAlertView和UIActionSheet合二为一为:UIAlertController . ...
- JQuery插件:遮罩+数据加载中。。。(特点:遮你想遮,罩你想罩)
在很多项目中都会涉及到数据加载.数据加载有时可能会是2-3秒,为了给一个友好的提示,一般都会给一个[数据加载中...]的提示.今天就做了一个这样的提示框. 先去jQuery官网看看怎么写jQuery插 ...
- js中提示框闪退问题
当页面存在刷新 或 在线引用iframe框架时(引用框架也会导致刷新) 会导致页面加载时的弹出框闪退 解决方法:设置弹出框在页面或者框架完全加载一段时间后再弹出 <script type=& ...
- jQuery Mobile 手动显示ajax加载器,提示加载中...
在使用jQuery Mobile开发时,有时候我们需要在请求ajax期间,显示加载提示框(例如:一个旋转图片+一个提示:加载中...).这个时候,我们可以手动显示jQuery Mobile的加载器,大 ...
- ASP.NET中页面加载时文本框(texbox控件)内有文字获得焦点时文字消失
代码如下: <asp:TextBox ID="TextBox1" runat="server" Height="26px" MaxLe ...
随机推荐
- C#基于UDP实现的P2P语音聊天工具(1)
这篇文章主要是一个应用,使用udp传送语音和文本等信息.在这个系统中没有服务端和客户端,相互通讯都是直接相互联系的.能够很好的实现效果. 语音获取 要想发送语音信息,首先得获取语音,这里有几种方法,一 ...
- python字符集选择
# coding=utf8 或者 # -*- coding:utf-8 -*- 在python2 中默认是ASCII码的字符集,但可以引入其他的字符集 这个需要在头信息中引入: 而在python3中 ...
- GCD 倒计时
今天在Code4App上看了一个GCD倒计时的Demo,觉得不错代码贴出来备用 -(void)startTime{ __block ; //倒计时时间 dispatch_queue_t queue = ...
- 对c#剪切板Clipboard占用的问题一点解决方法
以前在百度写的文档,转移到此处 前几天做一个程序,其中有一个剪切板的操作,具体代码: Clipboard.SetText(“ABC”); 来完成一个复制字符串的操作. 自己调试通过,完全正常,然后就交 ...
- 用CSS/CSS3 实现 水平居中和垂直居中的完整攻略
水平居中:行内元素解决方案 只需要把行内元素包裹在一个属性display为block的父层元素中,并且把父层元素添加如下属性即可: .parent { text-align:center; } 水 ...
- Javascript常用正则表达式
一.校验数字的表达式 数字:^[0-9]*$ n位的数字:^\d{n}$ 至少n位的数字:^\d{n,}$ m-n位的数字:^\d{m,n}$ 零和非零开头的数字:^(0|[1-9][0-9]*)$ ...
- Spark1.0.0 分布式环境搭建
软件版本号例如以下: Hostname IP Hadoop版本号 Hadoop 功能 系统 master 192.168.119.128 1.1.2 namenode jdk1.6+hadoop+sc ...
- MFC获取当前时间
获取按钮消息响应函数: void CTest17GetTimeDlg::OnGetTime() { // TODO: 在此添加控件通知处理程序代码 //UpdateData(true); CTime ...
- 触摸点为scrollview上的子控件时,scrollview不能滚动(iOS8)
现象:在iOS8上,scrollview上面布局了多行多列的button,滑动scrollview,如果当触摸点是在按钮上,scrollview不能滚动. 例如: 解决方法:设置scrollview的 ...
- CSS兼容性常见问题总结
DIV+CSS设计IE6.IE7.FF 兼容性 DIV+CSS网页布局这是一种趋势,我也开始顺应这股趋势了,不过在使用DIV+CSS网站设计的时候,应该注意css样式兼容不同浏览器问题,特别是对完全使 ...