解决方法
UI
ImageView提供必要的API来生成您自己的动画,如下所示:
UIImage *frame1 = [UIImage imageNamed:@"frame1.png"]; UIImage *frame2 = [UIImage imageNamed:@"frame2.png"]; UIImage *frame3 = [UIImage imageNamed:@"frame3.png"]; UIImage *frame4 = [UIImage imageNamed:@"frame4.png"]; UIImageView.animationImages = [[NSArray alloc] initWithObjects:frame1,frame2,frame3,frame4,nil]; UIImageView.animationDuration = 1.0 //defaults is number of animation images * 1/30th of a second UIImageView.animationRepeatCount = 5; //default is 0,which repeats indefinitely [UIImageView startAnimating]; //[uiImageView stopAnimating];