【代码笔记】iOS-MBProgressHUDDemo
2024-10-19 02:20:50
一,工程图。
二,代码。
RootViewController.h
#import <UIKit/UIKit.h>
//加入头文件
#import "MBProgressHUD.h" @interface RootViewController : UIViewController
<MBProgressHUDDelegate> {
MBProgressHUD *HUD;
} @end
RootViewController.m
#import "RootViewController.h"
//加入头文件
#import <unistd.h> @interface RootViewController () @end @implementation RootViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
} - (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view. //转动3s后停止
HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view];
HUD.delegate = self;
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
[self.navigationController.view addSubview:HUD]; }
//等待3s
- (void)myTask {
sleep(3);
}
最新文章
- Mysql联合,连接查询
- c++ 字符串流 sstream(常用于格式转换) 【转载】
- 20160308001 GridView的Sorting排序
- IRunningObjectTable接口
- CentOS 7.2 MySQL 5.7 主从配置
- SQL backup&;restore
- [jobdu]第一个只出现一次的字符
- android 68 单元测试
- Unity3D动态加载外部资源
- 关于如何解决谷歌Chrome浏览器空白页的问题
- 使用spring mvc返回JSON,chrome可以,firefox不行的问题定位
- 团队作业8----第二次项目冲刺(beta阶段)5.23
- 关于签名sign的坑
- 微服务框架之微软Service Fabric
- python面向对象三大特性之封装
- Format Conditions按条件显示表格记录
- C# 去除json字符串key引号
- mysql5.7启动slave报错 ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository
- HDU 5707 Combine String(动态规划)
- linux的bash和shell关系
热门文章
- MySQL 5.6不删空用户的影响
- JS脚本实现CSDN免登陆免关闭广告插件自动展开“阅读更多”内容
- 基于alpine用dockerfile创建的ssh镜像
- Ruby:线程实现经典的生产者消费者问题
- 用SpringSecurity从零搭建pc项目-01
- Log4j最佳实践
- 一口一口吃掉Hexo(三)
- jenkins发送邮件失败“No emails were triggered”
- Vue + Element UI 实现权限管理系统 前端篇(六):更换皮肤主题
- Vue笔记:VS Code 常用快捷键