且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

动画 GIF 在 iPhone 上不起作用

更新时间:2023-02-06 12:13:34

UIImageView 提供必要的 API 来制作您自己的动画,如下所示:

UIImageView provides the necessary APIs to produce your own animations like this:

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];