一,效果图。

二,代码。

ViewController.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib. //在导航栏中显示等待对话框
[self showActivityIndicatorViewInNavigationItem]; }
//点击任何处,停止等待指示器
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ //停止等待指示器,恢复导航栏
self.navigationItem.titleView = nil;
self.navigationItem.prompt = nil;
}
#pragma -mark -functions
//在导航栏中显示等待对话框
-(void) showActivityIndicatorViewInNavigationItem
{
UIActivityIndicatorView *aiview = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.navigationItem.titleView = aiview;
[aiview startAnimating];
self.navigationItem.prompt = @"数据加载中...";
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

最新文章

  1. 转:JQuery实现下拉框的数据加载和联动
  2. android 5.0 webview坑
  3. 转:CI伪静态化
  4. CSS换行2
  5. innerHTML与appendChild(newnodeText)的区别
  6. Jafka来源分析——Processor
  7. 构建自己的PHP框架--构建模版引擎(2)
  8. PHP抓取网页图片
  9. table动态增加删除
  10. HDU1269迷宫城堡(裸Tarjan有向图求强连通分量个数)
  11. shell脚本之获取CPU使用率
  12. 智能优化 之 下山单纯形法 C++
  13. [JS] Topic - define "class" by tricky methods
  14. 零点计费系统_Ros云计费(下面是对接教程)
  15. 【计算机视觉】如何使用opencv自带工具训练人脸检测分类器
  16. Java知识系列 -- 反射
  17. 实用vim 130+命令
  18. 【BZOJ】1058: [ZJOI2007]报表统计(splay+set)
  19. zigbee初探
  20. PHP通过header和meta实现页面编码声明

热门文章

  1. spring cloud 学习(6) - zuul 微服务网关
  2. Oracle数据库导入报ORA-39083处理
  3. 解决ubuntu安装系统默认没有创建root用户
  4. (转)OpenSSL CVE-2016-0800 和 CVE-2016-0703 漏洞修复细节拾趣
  5. 2015年第六届蓝桥杯C/C++程序设计本科B组决赛 完美正方形
  6. gitlab之gitlab-ci和gitlab-runner<二>
  7. gitlab之gitlab-ci和gitlab-runner<一>
  8. Spring事务传播属性介绍(二).mandatory、not_supported、never、supports
  9. Java设计模式学习记录-单例模式
  10. Linux 下面解压.tar.gz 和.gz文件解压的方式