- (void)viewDidLoad {
[super viewDidLoad];
UIImageView *fishAni=[[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.view addSubview:fishAni];
[fishAni release];
//设置动画帧
fishAni.animationImages=[NSArray arrayWithObjects:
[UIImage imageNamed:@"1.jpg"],
[UIImage imageNamed:@"2.jpg"],
[UIImage imageNamed:@"3.jpg"],
[UIImage imageNamed:@"4.jpg"],
[UIImage imageNamed:@"5.jpg"],nil ];
//设置动画总时间
fishAni.animationDuration=1.0;
//设置重复次数,0表示不重复
fishAni.animationRepeatCount=0;
//开始动画
[fishAni startAnimating];
}
[super viewDidLoad];
UIImageView *fishAni=[[UIImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.view addSubview:fishAni];
[fishAni release];
//设置动画帧
fishAni.animationImages=[NSArray arrayWithObjects:
[UIImage imageNamed:@"1.jpg"],
[UIImage imageNamed:@"2.jpg"],
[UIImage imageNamed:@"3.jpg"],
[UIImage imageNamed:@"4.jpg"],
[UIImage imageNamed:@"5.jpg"],nil ];
//设置动画总时间
fishAni.animationDuration=1.0;
//设置重复次数,0表示不重复
fishAni.animationRepeatCount=0;
//开始动画
[fishAni startAnimating];
}
来源:https://www.cnblogs.com/chen1987lei/archive/2011/07/11/2103478.html