实例iPhone编程入门教程-第二天
来源:互联网 发布:韶关网络布线公司 编辑:程序博客网 时间:2024/06/05 03:17
Day Two Bonfire
今天试试运用 UIImageView 来制作一个"营火动画"
首先运行以安装好的xCode,和第一天一样
选择: File->New Project.
从 "New Project" 窗口
选择: iPhone OS ->Applications-> View-Based Application
命名:我这里命名为"Bonfire"
(1)在xcode打开BonfireViewController.m文件
在-(void)viewDidLoad{ }里面添加代码,如下
-(void)viewDidLoad{
// create the view that will execute our animation
UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame];
// load all the frames of our animation
campFireView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"campFire01.gif"],
[UIImage imageNamed:@"campFire02.gif"],
[UIImage imageNamed:@"campFire03.gif"],
[UIImage imageNamed:@"campFire04.gif"],
[UIImage imageNamed:@"campFire05.gif"],
[UIImage imageNamed:@"campFire06.gif"],
[UIImage imageNamed:@"campFire07.gif"],
[UIImage imageNamed:@"campFire08.gif"],
[UIImage imageNamed:@"campFire09.gif"],