IOS第16天(5,Quartz2D雪花)
***
#import "HMView.h" @interface HMView()
{
int count;
}
@property (nonatomic, assign) CGFloat snowY; @end @implementation HMView - (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
} // 加载xib完毕就调用
- (void)awakeFromNib
{
// [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(setNeedsDisplay) userInfo:nil repeats:YES]; // iphone每秒刷新60次
// 屏幕刷新的时候就会触发
CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(setNeedsDisplay)]; [link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
} // Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{ _snowY += ; UIImage *image = [UIImage imageNamed:@"雪花"];
[image drawAtPoint:CGPointMake(, _snowY)]; // Drawing code if (_snowY >= ) {
_snowY = ;
}
} @end
IOS第16天(5,Quartz2D雪花)的更多相关文章
- IOS第16天(4,Quartz2D柱状图)
*** #import "HMBarView.h" #import "UIColor+Random.h" @implementation HMBarView - ...
- IOS第16天(3,Quartz2D饼图)
**** #import "HMPieView.h" #import "UIColor+Random.h" @implementation HMPieView ...
- IOS第16天(2,Quartz2D下载进度条)
*************自定义下载的view的方法 #import "HMProgressView.h" @interface HMProgressView() @propert ...
- IOS第16天(1,Quartz2D基本图像绘制)
***************基本图像绘制 画线 #import "HMLineView.h" @implementation HMLineView - (id)initWithF ...
- AJ学IOS(33)UI之Quartz2D雪花飘落效果刷帧
AJ分享,必须精品 效果: 可以加入随机数实现真的飘落效果哦. 代码: -(id)initWithCoder:(NSCoder *)aDecoder { //请注意这里一定要先初始化父类的构造方法 i ...
- iOS根据16进制的色号来设置颜色,适合封装工具类
iOS中有时候UI给的一个色号就像 #54e1b7 这个,而我们一般设置颜色都是根据RBG来设置的,所以这里需要把这个16进制的色号转为RGB值,这里我们就使用一下的方法来调用设置颜色. + (UIC ...
- [Draft]iOS.Architecture.16.Truth-information-flow-and-clear-responsibilities-immutability
Concept: Truth, Information Flow, Clear Responsibilities and Immutability 1. Truth 1.1 Single Source ...
- [iOS]把16进制(#871f78)颜色转换UIColor
// // ViewController.m // text // // Created by 李东旭 on 16/1/22. // Copyright © 2016年 李东旭. All rights ...
- 【转】iOS中16进制转10进制
原文网址:http://www.voidcn.com/blog/u012198553/article/p-4976772.html /// 将十六进制的字符串转化为NSData - (NSData ) ...
随机推荐
- node.js整理 06异步编程
回调 异步编程依托于回调来实现,但不能说使用了回调后程序就异步化了 function heavyCompute(n, callback) { var count = 0, i, j; for (i = ...
- 快消品销售管理系统,PDA销售管理系统,销售拜访PDA,进销存管理PDA系统 移动扫描打印开单POS
各种ERP软件的移动订单及移动车销解决方案是针对各个需要快速.便捷的,通过智能PDA移动智能终端设备实现销售订单下达及快速车销的应用解决方案.通过将移动订单及移动车销集成到ERP的移动解决方案,可以帮 ...
- 关于window.showModalDialog的一些配置
关于window.showModalDialog的一些配置 一.window.showModalDialog的滚动条 其实纵向滚动条很好去掉,难办的就是横向滚动条.在Firefox下如果window. ...
- Delphi7 客户端调用WebService(天气预报)
客户程序:第一步:新建一个Application. 第二步:File----->New----->Other------>WebServices----->WSDL Impor ...
- 在字符界面tty1~tty6中使用鼠标,并用其复制粘贴
1. 安装 无意间看到gpm这个服务可以让你在tty1~tty6 环境中使用鼠标. 先用 rpm -qa gpm 查看是否已经安装此服务,如果提示以安装,则可以直接开启: 否则就要通过 yum ins ...
- iOS instancetype or id ?
The id type simply says a method will return a reference to an object. It could be any object of any ...
- EF框架step by step(7)—Code First DataAnnotations(2)
上一篇EF框架step by step(7)—Code First DataAnnotations(1)描述了实体内部的采用数据特性描述与表的关系.这一篇将用DataAnnotations描述一下实体 ...
- CF#335 Intergalaxy Trips
Intergalaxy Trips time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- BZOJ3631[JLOI2014]松鼠的新家 题解
题目大意: 给你一棵树,要从编号为a[1]的节点走到编号为a[2]的节点再走到编号为a[3]的节点……一直走到编号为a[n]的节点.问每个节点最少访问多少次. 思路: 将其进行轻重链剖分,则从a[i] ...
- 【BZOJ】2172: Mario填格子
题意 \(3 * 3\)的网格,给出左上角的数字\(m\)和右下角的数字\(m\),如果当前格子有数字\(x\),格子左边有个数字\(y\),格子上面有个数字\(z\),则\(y|x, z|x\).格 ...