#import "MyViewController.h"
@interface MyViewController ()
@end
@implementation MyViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self=[super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title=@"图片动画";
UIImageView *pImageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 125, 320, 213)];
NSArray *array=[[NSArray alloc]initWithObjects:[UIImage imageNamed:@"p1"],[UIImage imageNamed:@"p2"],[UIImage imageNamed:@"p3"],[UIImage imageNamed:@"p4"], nil];
pImageView.animationImages=array; 每帧图片
pImageView.animationDuration=4.0f;// 动画一次全播放总时间
pImageView.animationRepeatCount=0;// 播放次数
[pImageView startAnimating];//开始动画
[self.view addSubview:pImageView];
[pImageView release];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
ios 图片动画
最新推荐文章于 2023-05-27 18:57:56 发布