IOS 下雪修改版本

电脑杂谈  发布时间:2019-08-25 22:02:35  来源:网络整理

梦见下雨下雪了_ios下雪下雨的_先梦见下雪然后在下雨

IOS 下雪修改版本

ios下雪下雨的_梦见下雨下雪了_先梦见下雪然后在下雨

#define SNOW_IMAGENAME         @"snow"
#define IMAGE_X                arrandom()%(int)Main_Screen_Width
#define IMAGE_ALPHA            ((float)(arrandom()))/10
#define IMAGE_WIDTH            arrandom()%20 + 10
#define PLUS_HEIGHT            Main_Screen_Height/25
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(makeSnow) userInfo:nil repeats:YES];
}
- (void)makeSnow
{
    UIImageView *imageView = [[UIImageView alloc] initWithImage:IMAGENAMED(SNOW_IMAGENAME)];
    float x = IMAGE_WIDTH;
    imageView.frame = CGRectMake(IMAGE_X, -30, x, x);
    imageView.alpha = IMAGE_ALPHA;
    [self.view addSubview:imageView];
    
    [self snowFall:imageView];
}
- (void)snowFall:(UIImageView *)aImageView
{
    [UIView beginAnimations:[NSString stringWithFormat:@"%i",aImageView.tag] context:nil];
    [UIView setAnimationDuration:6];
    [UIView setAnimationDelegate:self];
    aImageView.frame = CGRectMake(aImageView.frame.origin.x, Main_Screen_Height, aImageView.frame.size.width, aImageView.frame.size.height);
    NSLog(@"%@",aImageView);
    [UIView commitAnimations];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end

ios下雪下雨的_先梦见下雪然后在下雨_梦见下雨下雪了

posted @ 2014-03-07 16:26菜鸟程序猿 阅读(...) 评论(...) 编辑


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/shouji/article-120577-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...