博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
雪花效果
阅读量:6955 次
发布时间:2019-06-27

本文共 1368 字,大约阅读时间需要 4 分钟。

hot3.png

@interface ViewController (){    UIImage *image;}- (IBAction)didAction:(id)sender;@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];    self.view.backgroundColor = [UIColor cyanColor];    //雪花图片    image = [UIImage imageNamed:@"iconfont-xuehua"];    //启动定时器    [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(showTime) userInfo:nil repeats:YES];    // Do any additional setup after loading the view, typically from a nib.}- (void)showTime {    //创建雪花    UIImageView *imageV = [[UIImageView alloc] initWithImage:image];    //添加    [self.view addSubview:imageV];        NSInteger startX = arc4random()%356 + 10;    //雪花开始位置    imageV.frame = CGRectMake(startX, 50, 50, 50);    //动画    [UIView animateWithDuration:2 animations:^{        //雪花下落位置        imageV.frame = CGRectMake(startX, self.view.frame.size.height, 30, 30);    } completion:^(BOOL finished) {        //动画完成移除雪花        [imageV removeFromSuperview];    }];    }- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}- (IBAction)didAction:(id)sender {        WebViewController *web = [[WebViewController alloc] initWithNibName:@"WebViewController" bundle:nil];    [self.navigationController pushViewController:web animated:YES];}@end

转载于:https://my.oschina.net/u/2519763/blog/635809

你可能感兴趣的文章
提取字符串里面数字
查看>>
程序员版《那些年我们一起追过的女孩》(1)
查看>>
关于SQL server AS Adventure Works DW 演示部署的错误解决
查看>>
c语言常见算法
查看>>
指针理解——复杂指针解析
查看>>
标题:李白打酒
查看>>
记一次生产环境中得删系统库行为
查看>>
JS心得——判断一个对象是否为空
查看>>
软件工程开学第一课
查看>>
深入理解正则表达式高级教程
查看>>
Selenium webdriver+Java-------如何等待页面元素加载完成
查看>>
学习MySQL(上)
查看>>
我开通了cnblog的博客 大家快来看吧
查看>>
P1115 最大子段和
查看>>
poj 3617 best cow line
查看>>
动态列报表
查看>>
JAVA 8 多态
查看>>
九,编程的三种结构
查看>>
python爬虫系列之爬京东手机数据
查看>>
贪吃蛇
查看>>