使用ios将图像转换成gif

我试图转换10个UIImages格式编程使用IOS Xcode 4.5,并保存在画廊,但我没有运气我甚至在stackoverflow尝试一个问题创build和通过iOS导出一个GIFanimation? 我没有得到什么是__bridge id使用的variables是什么,我怎么可以分配这些图像的方法,请帮助….

首先,你应该在Apple文档中检查你的问题。 一切都在那里。 你需要的是研究和阅读

你应该尝试ImageIO框架 。 它可以将.png文件转换为CGImageRef对象,然后将CGImageRefs导出为.gif文件

将图像保存到图片库: UIImageWriteToSavedPhotosAlbum(imageToSave, nil, nil, nil); 也logging在UIKit 。

而不是将图像转换为Gif苹果提供的UIImageView.animationImages proparty,你可以animation像gif一个接一个的图像。 像贝娄代码: –

 UIImage *statusImage = [UIImage imageNamed:@"status1.png"]; YourImageView = [[UIImageView alloc] initWithImage:statusImage]; //Add more images which will be used for the animation YourImageView.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"status1.png"], [UIImage imageNamed:@"status2.png"], [UIImage imageNamed:@"status3.png"], [UIImage imageNamed:@"status4.png"], [UIImage imageNamed:@"status5.png"], [UIImage imageNamed:@"status6.png"], [UIImage imageNamed:@"status7.png"], [UIImage imageNamed:@"status8.png"], [UIImage imageNamed:@"status9.png"], nil]; //setFrame of postion on imageView YourImageView.frame = CGRectMake( self.view.frame.size.width/2 -statusImage.size.width/2, self.view.frame.size.height/2 -statusImage.size.height/2, statusImage.size.width, statusImage.size.height); YourImageView.center=CGPointMake(self.view.frame.size.width /2, (self.view.frame.size.height)/2); YourImageView.animationDuration = 1; [self.view addSubview:YourImageView];