迅捷分享GIF [英] Sharing Gifs Swift
本文介绍了迅捷分享GIF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将如何在Swift中共享Gif?我现在使用的共享Gif URL的方法仅共享一个图像,而不共享动画Gif图像.这是我现在所拥有的:
How would I share a Gif in Swift? The method I am using right now to share the Gif URL only shares one image and does not share the animated Gif image. Here is what I have right now:
var cell = self.collectionView.cellForItemAtIndexPath(index)
println(index.item)
var URLString: String = contentArray[index.item].contentUrlStirng
var shareURL: NSURL = NSURL(string: "\(URLString)")!
var shareImage: UIImage = UIImage.animatedImageWithAnimatedGIFURL(shareURL)
let firstActivityItem: Array = [shareImage]
let activityViewController:UIActivityViewController = UIActivityViewController(activityItems: firstActivityItem, applicationActivities: nil)
self.presentViewController(activityViewController, animated: true, completion: nil)
URLString
包含一个.gif链接.有人会分享Gif图片吗?
The URLString
contains a .gif link. Would anyone know how to share the Gif image?
推荐答案
我已经找到答案了.您不必共享实际的图像.要共享gif,您要做的就是这样共享数据:
I have figured out the answer. You don't have to share the actual image. To share a gif all you do is share the data as such:
var cell = self.collectionView.cellForItemAtIndexPath(index)
println(index.item)
var URLString: String = contentArray[index.item].contentUrlStirng
var shareURL: NSURL = NSURL(string: "\(URLString)")!
var shareData: NSData = NSData(contentsOfURL: shareURL)!
let firstActivityItem: Array = [shareData]
let activityViewController:UIActivityViewController = UIActivityViewController(activityItems: firstActivityItem, applicationActivities: nil)
self.presentViewController(activityViewController, animated: true, completion: nil)
快乐编码!
这篇关于迅捷分享GIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文