【代码笔记】iOS-在导航栏中显示等待对话框
2024-08-26 08:05:19
一,效果图。
二,代码。
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
最新文章
- 转:JQuery实现下拉框的数据加载和联动
- android 5.0 webview坑
- 转:CI伪静态化
- CSS换行2
- innerHTML与appendChild(newnodeText)的区别
- Jafka来源分析——Processor
- 构建自己的PHP框架--构建模版引擎(2)
- PHP抓取网页图片
- table动态增加删除
- HDU1269迷宫城堡(裸Tarjan有向图求强连通分量个数)
- shell脚本之获取CPU使用率
- 智能优化 之 下山单纯形法 C++
- [JS] Topic - define ";class"; by tricky methods
- 零点计费系统_Ros云计费(下面是对接教程)
- 【计算机视觉】如何使用opencv自带工具训练人脸检测分类器
- Java知识系列 -- 反射
- 实用vim 130+命令
- 【BZOJ】1058: [ZJOI2007]报表统计(splay+set)
- zigbee初探
- PHP通过header和meta实现页面编码声明
热门文章
- spring cloud 学习(6) - zuul 微服务网关
- Oracle数据库导入报ORA-39083处理
- 解决ubuntu安装系统默认没有创建root用户
- (转)OpenSSL CVE-2016-0800 和 CVE-2016-0703 漏洞修复细节拾趣
- 2015年第六届蓝桥杯C/C++程序设计本科B组决赛 完美正方形
- gitlab之gitlab-ci和gitlab-runner<;二>;
- gitlab之gitlab-ci和gitlab-runner<;一>;
- Spring事务传播属性介绍(二).mandatory、not_supported、never、supports
- Java设计模式学习记录-单例模式
- Linux 下面解压.tar.gz 和.gz文件解压的方式