一,效果图。

二,工程图。

三, 代码。

ViewController.h

#import <UIKit/UIKit.h>
//loading
#import "GPLoadingButton.h" @interface ViewController : UIViewController
{
//loading
GPLoadingButton *loadingButton;
UIView *backViewLoad;
} @end

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. //loading
[self addLoadingView];
}
//点击任何处,loading出现
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
backViewLoad.hidden=NO;
loadingButton.hidden=NO;
[loadingButton startActivity];
//5s后loading消失
[self performSelector:@selector(loadingStop) withObject:nil afterDelay:2];
}
-(void)loadingStop
{
backViewLoad.hidden=YES;
loadingButton.hidden=YES;
[loadingButton stopActivity];
}
#pragma -mark --loading------
-(void)addLoadingView
{
backViewLoad=[[UIView alloc]initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, self.view.frame.size.height)];
backViewLoad.backgroundColor=[UIColor blackColor];
backViewLoad.alpha=0.7;
backViewLoad.hidden=YES;
[self.view addSubview:backViewLoad]; loadingButton = [[GPLoadingButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width/2-20, (self.view.frame.size.height-38)/2-20, 40, 40)];
loadingButton.rotatorColor = [UIColor colorWithRed:59/255.0 green:89/255.0 blue:152/255.0 alpha:1.0];
loadingButton.hidden=YES;
[self.view addSubview:loadingButton]; } - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
} @end

最新文章

  1. 玩转spring boot——结合JPA入门
  2. C# ACCESS数据库操作类
  3. 三、基础功能模块,用户类别管理——锁、EF并发处理、领域服务、应用服务的划分
  4. 简单方便统一封装的傻瓜式GET/POST库AliasNet正式公布~开源喽~
  5. Windows 注册表操作
  6. 从 PHP 到 Java
  7. 【做题】ZJOI2017仙人掌——组合计数
  8. C语言---指针变量详解2
  9. Core DES加、解密
  10. Android绘制优化(一)绘制性能分析
  11. Spring框架的第四天(整合ssh框架)
  12. centos7: nginx安装配置
  13. 漏洞复现——tomcat远程代码执行漏洞
  14. 1118 Birds in Forest (25 分)
  15. ES6-Iterator &amp; for...of循环
  16. 使用UltraISO制作U盘启动
  17. docker微服务部署之:三,搭建Zuul微服务项目
  18. 项目经验:GIS&lt;MapWinGIS&gt;建模第五天
  19. 【bzoj3754】Tree之最小方差树 最小生成树
  20. 【spring源码学习】spring的IOC容器在初始化bean过程

热门文章

  1. MySQL 逻辑物理备份测试
  2. 在Storm的Toplogy中设置多数据源Spout
  3. Redis学习系列六ZSet(有序列表)及Redis数据结构的过期
  4. SSH远程连接Ubuntu Server
  5. ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Cannot run program &quot;hive&quot;: error=2, No such file or directory
  6. java多线程并发控制countDownLatch和cyclicBarrier的使用
  7. 关于Android系统的启动流程
  8. logstash-2-插件配置
  9. tomcat关闭后线程依然运行解决办法
  10. offsetHeight,scrollHeight,clientHeight,scrollTop以及pageX,clientX,offsetX,screenX,offsetLeft,style.left等的区别以及使用详解