我不知道如何使用UIActivityViewController分享动画.gif图像.请帮我解决这个问题.谢谢提前
see this image .i am displaying this type of images and to share these images I am using uiactivity view but it is not animating .it's just displaying image
if(imgFrameCount==1)
{
imgFrameCount++;
NSURL *url1=[[NSBundle mainBundle]URLForResource:@"animated2" withExtension:@"gif"];
self.firstImage=[UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url1]];
self.frameImage.image = self.firstImage;
}
else if (imgFrameCount==2)
{
imgFrameCount++;
NSURL *url2=[[NSBundle mainBundle]URLForResource:@"animated3" withExtension:@"gif"];
self.firstImage=[UIImage animatedImageWithAnimatedGIFData:[NSData dataWithContentsOfURL:url2]];
self.frameImage.image = self.firstImage;
}
Run Code Online (Sandbox Code Playgroud)
FWIW,我在尝试在ActivityItems数组中包含UIImage时遇到了同样的问题.它不适用于通用的UIImage,也不适用于使用UIImage + animagedGIF类别的UIImage,也不适用于FLAnimatedImage.
要解决此问题,至少在iOS8上,只需将gif作为NSData对象而不是UIImage添加到ActivityItems数组中.
例如,假设从URL请求gif:
NSURL *imagePath = [NSURL URLWithString:@"http://i.imgur.com/X4oonnm.gif"];
NSData *animatedGif = [NSData dataWithContentsOfURL:imagePath];
NSArray *sharingItems = [NSArray arrayWithObjects: animatedGif, nil];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2936 次 |
| 最近记录: |