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 http 服务
var http = require("http") http.createServer(function(req,res){ res.writeHead(200,{"C ...
- Javascript参考手册
---------------------------------------------------------------------------------------------------- ...
- eclipse安装genymotion的奇葩问题
安装方法: 1:启动Eclipse 2:打开"Help/Install new software"菜单 在新开启的窗口中点击"add"按钮(位于窗口右上方) 在 ...
- 接口测试第二课(Fiddler实现APP抓包)
Fiddler简介: Fiddler是强大且好用的Web调试工具之一,它能记录客户端和服务器的http和https请求,允许你监视,设置断点,甚至修改输入输出数 据. Fiddler 的运行机制其实就 ...
- HDU1402 A * B Problem Plus(FFT)
http://acm.hdu.edu.cn/showproblem.php?pid=1402 初学FFT. http://www.cnblogs.com/WABoss/p/FFT_Note.html ...
- CodeForces#275--DIV 2--B(BinarySearch)(!!)
B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input stand ...
- myeclipse下拷贝的项目,tomcat下部署名称和导出为war包的名称默认值修改
拷贝一个项目,作为一个新的项目,给它换了名字,这时候默认的部署名称等都是原来项目的,这时候要在属性里面修改一下.
- CSS样式覆盖顺序
有时候在写CSS的过程中,某些限制总是不起作用,这就涉及了CSS样式覆盖的问题,如下 Css代码 #navigator { height: 100%; width: 200; position: ...
- Codeforces Round #195 (Div. 2) A. Vasily the Bear and Triangle
水题,注意数据范围即可 #include <iostream> #include <algorithm> #include <utility> using name ...
- Loadrunner脚本录制常见问题整理
1.LoadRunner录制脚本时为什么不弹出IE浏览器? 当一台主机上安装多个浏览器时,LoadRunner录制脚本经常遇到不能打开浏览器的情况,可以用下面的方法来解决. 启动浏览器,打开Inter ...