且构网

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

在 Iphone UIImageView 中添加动画 Gif 图像

更新时间:2023-12-05 16:36:52

UIImageView* animatedImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
animatedImageView.animationImages = [NSArray arrayWithObjects:    
                               [UIImage imageNamed:@"image1.gif"],
                               [UIImage imageNamed:@"image2.gif"],
                               [UIImage imageNamed:@"image3.gif"],
                               [UIImage imageNamed:@"image4.gif"], nil];
animatedImageView.animationDuration = 1.0f;
animatedImageView.animationRepeatCount = 0;
[animatedImageView startAnimating];
[self.view addSubview: animatedImageView];

您可以加载多个 gif 图像.

You can load more than one gif images.

您可以使用以下 ImageMagick 命令分割您的 gif:

You can split your gif using the following ImageMagick command:

convert +adjoin loading.gif out%d.gif