我已经在 adobe flash 中创建了一个 gif 动画,现在我想在 Xcode 中将它导入到我的应用程序中。我有 383 个 gif 图像(帧),我编写了这段代码来创建流畅的动画:
#import "ViewController.h"
#define IMAGE_COUNT 383
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
//////////////////
// Build array of images, cycling through image names
for (int i = 0; i < IMAGE_COUNT; i++)
imageView.animationImages = [[NSArray alloc]initWithObjects:[UIImage imageNamed:
[NSString stringWithFormat:@"picollage00%d.gif", i]],nil];
imageView.animationRepeatCount = 5;
[imageView startAnimating];
// Do any additional setup after loading the view, typically from a nib.
}
图像是这样的,然后图像数到 piclage0383.gif