星空网 > 软件开发 > 操作系统

【代码笔记】浇花动画

一,效果图。

【代码笔记】浇花动画images/loading.gif' data-original="http://images2015.cnblogs.com/blog/337518/201510/337518-20151019142333036-1462967838.jpg" width="218" height="400" />

二,工程图。

【代码笔记】浇花动画

三,代码。

RootViewController.h

【代码笔记】浇花动画
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController{  NSTimer *timer;  int i;}@end
【代码笔记】浇花动画

 

RootViewController.m

【代码笔记】浇花动画
- (void)viewDidLoad{  [super viewDidLoad];  // Do any additional setup after loading the view.    //初始化背景图  [self initBackGroundView];  }#pragma -mark -functions//背景图-(void)initBackGroundView{  //人  UIImageView *loadPeopleView = [[UIImageView alloc] initWithFrame:CGRectMake(130, 100, 156, 172)];  loadPeopleView.tag = 101;  loadPeopleView.alpha = 1.0f;  loadPeopleView.backgroundColor=[UIColor clearColor];  [loadPeopleView setImage:[UIImage imageNamed:@"problem_load.png"]];    //花  UIImageView *loadFlowerView = [[UIImageView alloc] initWithFrame:CGRectMake(70, 200, 62, 75)];  loadFlowerView.tag = 102;  loadFlowerView.alpha = 1.0f;  [loadFlowerView setImage:[UIImage imageNamed:@"problem_load1.png"]];    [self.view addSubview:loadPeopleView];  [self.view addSubview:loadFlowerView];    timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(animation:) userInfo:nil repeats:YES];}//动画- (void)animation:(NSTimer *)timer{  NSLog(@"-i-%i--",i);  UIImageView *imageView = (UIImageView *)[self.view viewWithTag:102];  i++;  if (i%3 == 0) {    [imageView setImage:[UIImage imageNamed:@"problem_load1.png"]];  }else if (i%3 == 1){    [imageView setImage:[UIImage imageNamed:@"problem_load2.png"]];  }else{    [imageView setImage:[UIImage imageNamed:@"problem_load3.png"]];  }}
【代码笔记】浇花动画

 




原标题:【代码笔记】浇花动画

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

向国外个人账户汇款:https://www.goluckyvip.com/tag/72848.html
枪击案:https://www.goluckyvip.com/tag/7285.html
海外开账户:https://www.goluckyvip.com/tag/72850.html
如何外国期货开户:https://www.goluckyvip.com/tag/72851.html
境外投资开户:https://www.goluckyvip.com/tag/72852.html
海外开户见证业务:https://www.goluckyvip.com/tag/72855.html
安能物流的2024:变革不能停:https://www.kjdsnews.com/a/1836480.html
深圳中心公园朱顶红花海位置(在哪里+怎么去):https://www.vstour.cn/a/364175.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流