#import "drawSnowflake.h"
@implementation drawSnowflake
- (void)awakeFromNib
{
CADisplayLink *disPLK = [CADisplayLink displayLinkWithTarget:self selector:@selector(changeValue)];;
[disPLK addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode];
}
static CGFloat pointY = 0;
- (void)changeValue
{
pointY += 10;
if (pointY > [UIScreen mainScreen].bounds.size.height) {
pointY = 0;
}
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
UIImage *image = [UIImage imageNamed:@"雪花"];
[image drawAtPoint:CGPointMake(0, pointY)];
}
@end