【代码笔记】iOS-自定义loading
一,效果图。

二,工程图。

三, 代码。
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

【代码笔记】iOS-自定义loading的更多相关文章
- iOS 自定义导航栏笔记
一.UINavigationBar的结构 导航栏几乎是每个页面都会碰到的问题,一般两种处理方式:1.隐藏掉不显示 2.自定义 1. 添加导航栏 TestViewController * mainVC ...
- 【iOS自定义键盘及键盘切换】详解
[iOS自定义键盘]详解 实现效果展示: 一.实现的协议方法代码 #import <UIKit/UIKit.h> //创建自定义键盘协议 @protocol XFG_KeyBoardDel ...
- Cocos2d-JS 自定义loading界面
[转]http://blog.csdn.net/et_sandy/article/details/41415047 环境: win7 64位 Cocos2d-JS v3.1 Cocos Code ID ...
- 笔记-iOS 视图控制器转场详解(上)
这是一篇长文,详细讲解了视图控制器转场的方方面面,配有详细的示意图和代码,为了使得文章在微信公众号中易于阅读,seedante 辛苦将大量长篇代码用截图的方式呈现,另外作者也在 Github 上附上了 ...
- iOS自定义的UISwitch按钮
UISwitch开关控件 开关代替了点选框.开关是到目前为止用起来最简单的控件,不过仍然可以作一定程度的定制化. 一.创建 UISwitch* mySwitch = [[ UISwitchalloc] ...
- IOS开发笔记 IOS如何访问通讯录
IOS开发笔记 IOS如何访问通讯录 其实我是反对这类的需求,你说你读我的隐私,我肯定不愿意的. 幸好ios6.0 以后给了个权限控制.当打开app的时候你可以选择拒绝. 实现方法: [plain] ...
- Hadoop学习笔记—5.自定义类型处理手机上网日志
转载自http://www.cnblogs.com/edisonchou/p/4288737.html Hadoop学习笔记—5.自定义类型处理手机上网日志 一.测试数据:手机上网日志 1.1 关于这 ...
- <Python Text Processing with NLTK 2.0 Cookbook>代码笔记
如下是<Python Text Processing with NLTK 2.0 Cookbook>一书部分章节的代码笔记. Tokenizing text into sentences ...
- OpenGL ES: iOS 自定义 UIView 响应屏幕旋转
iOS下使用OpenGL 如果使用GLKit View 那么不用担心屏幕旋转的问题,说明如下: If you change the size, scale factor, or drawable pr ...
- 自定义loading效果
结合Font Awesome字体图标自定义loading效果 Font Awesome字体图标地址:http://www.fontawesome.com.cn/faicons/ 使用javascrip ...
随机推荐
- cFSMN和FSMN参数规模对比分析
1. FSMN参数规模分析 (1)分析前提: 假设隐藏层单元规模都为n 只分析前向t个时刻的结构,即暂时不考虑双向的结构 只分析向量系数编码,即vFSMN,暂时不考虑sFSMN ...
- 基础I/O接口与操作
C语言中的文件接口 1 打开文件 FILE * fopen(const char * path,const char * mode) 参数:path:文件路径 mode:打开文件的方式 返回值:成功返 ...
- (转载)es进行聚合操作时提示Fielddata is disabled on text fields by default
原文地址:http://blog.csdn.net/u011403655/article/details/71107415 根据es官网的文档执行 GET /megacorp/employee/_se ...
- spring cloud sleuth
新建spring boot工程trace-1,添加pom依赖 <dependency> <groupId>org.springframework.cloud</group ...
- Android_view的生命周期
onFinishInflate() 当View中所有的子控件均被映射成xml后触发 onMeasure( int , int ) 确定所有子元素的大小 onLayout( boolean , int ...
- C#基础篇四数组
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace P01A ...
- 19-hadoop-fof好友推荐
好友推荐的案例, 需要两个job, 第一个进行好友关系度计算, 第二个job将计算的关系进行推荐 1, fof关系类 package com.wenbronk.friend; import org.a ...
- Linux交换空间和内存不足
交换空间 交换技术就是将一页内存复制到预先设定的硬盘上的交换空间,来释放该页占用内存.物理内存和交换空间的和就是可提供的虚拟内存的总量.Linux有两种形式的交换方式,分别是交换分区,交换文件. 优点 ...
- js Date对象总结
Date在js中和Array类似,都是拥有自己的特殊方法的特殊对象. 由于平常用到Date着实不多,对它的了解颇浅.上周被问到怎么样获取某年某个月的天数,我当时想了一会儿,回答说有两种,一种自己写判断 ...
- mysql索引总结(2)-MySQL聚簇索引和非聚簇索引
mysql索引总结(1)-mysql 索引类型以及创建 mysql索引总结(2)-MySQL聚簇索引和非聚簇索引 mysql索引总结(3)-MySQL聚簇索引和非聚簇索引 mysql索引总结(4)-M ...