zoukankan      html  css  js  c++  java
  • iOS—雪花飘落动画效果

    //
    //  HMview.h
    //  雪花飘落效果
    //
    //  Created by YaguangZhu on 15/9/9.
    //  Copyright (c) 2015年 YaguangZhu. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface HMview : UIView
    
    @end
    
    
    //
    //  HMview.m
    //  雪花飘落效果
    //
    //  Created by YaguangZhu on 15/9/9.
    //  Copyright (c) 2015年 YaguangZhu. All rights reserved.
    //
    
    #import "HMview.h"
    @interface HMview()
    
    @property(nonatomic,assign)CGFloat snowY;
    
    @end
    
    @implementation HMview
    
    - (void)awakeFromNib
    {
    //    [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(setNeedsDisplay) userInfo:nil repeats:YES];
        
        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 {
        // Drawing code
        _snowY += 10;
        UIImage *imgae = [UIImage imageNamed:@"003"];
        [imgae drawAtPoint:CGPointMake(0, _snowY)];
        if (_snowY >= 480) {
            _snowY =0;
        }
        
    }
    
    
    @end
  • 相关阅读:
    rowkey设计原则和方法
    ubuntu安装及使用
    sqoop数据迁移
    Hive 自定义UDF操作步骤
    hive之数据导入导出
    MySQL优化
    MongoDB、Redis、elasticSearch、hbase的对比
    数据库基本操作
    count(*) 和 count(1)和count(列名)区别
    BigDecimal的运算——加减乘除
  • 原文地址:https://www.cnblogs.com/zhuyaguang/p/4795999.html
Copyright © 2011-2022 走看看