imageview从Url加载图片
此代码用于保存图像
let indexPath = collectionView!.indexPathsForVisibleItems().last!
let cell = collectionView?.cellForItemAtIndexPath(indexPath) as! PhotoBrowserCell
if cell.imageView.image == nil{
print("image nil")
} else {
UIImageWriteToSavedPhotosAlbum(cell.imageView.image!, self, "image:didFinishSavingWithError:contextInfo:", nil)
}
cell.imageView.image
我不知道如何使用share,
从imageview分享图片的最佳方式是什么
更新
我做了^ _ ^
此代码适用于从我的imageview分享
let indexPath = collectionView!.indexPathsForVisibleItems().last!
let cell = collectionView?.cellForItemAtIndexPath(indexPath) as! PhotoBrowserCell
if let image = (cell.imageView.image)
{
let vc = UIActivityViewController(activityItems: [image], applicationActivities: [])
self.window?.rootViewController?.presentViewController(vc, animated: true, completion: nil)
}
答案 0 :(得分:2)
你问如何在iOS中实现共享?这是一个相当复杂的主题。您想阅读Xcode文档中的var readLines = File.ReadLines(this.Filepath)
.Skip(rowStartAt).Take(numToTake)
.Select(s => s.Split(new char[] { ',' }).Skip(timeStampCol)
.Select(x => Convert.ToSingle(x)).ToList()).ToList();
,也许还可以找到有关在iOS中实现共享的教程。
答案 1 :(得分:1)
我做了^ _ ^
此代码
let indexPath = collectionView!.indexPathsForVisibleItems().last!
let cell = collectionView?.cellForItemAtIndexPath(indexPath) as! PhotoBrowserCell
if let image = (cell.imageView.image)
{
let vc = UIActivityViewController(activityItems: [image], applicationActivities: [])
self.window?.rootViewController?.presentViewController(vc, animated: true, completion: nil)
}