的项目所以我用下面的代码来获取所有从库,做工精细的图像:得到列表和全尺寸的图像缩略图时,点击列表
func grabPhotos(){
let imgManager = PHImageManager.default()
let requestOptions = PHImageRequestOptions()
requestOptions.isSynchronous = true
requestOptions.deliveryMode = .highQualityFormat
let fetchOptions = PHFetchOptions()
fetchOptions.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: true)]
if let fetchResults : PHFetchResult = PHAsset.fetchAssets(with: .image, options: fetchOptions){
if fetchResults.count>0{
for i in 0..<fetchResults.count{
imgManager.requestImage(for: fetchResults.object(at: i), targetSize: CGSize(width:100, height: 100), contentMode: .aspectFill, options: requestOptions, resultHandler: {
image, error in
self.Galleryimages.append(image!)
print("array count is ",self.Galleryimages.count)
self.photoCollectionview.reloadData()
})
}
}
}
}
我显示所有图片在我的UICollectionView,但我没有找到任何方式获得原始图像,每当点击任何缩略图图像。当用户点击UICollectionView中填充的任何缩略图图像时,我想获取原始图像(全尺寸图像)。
谢谢。
意味着你想要做什么? –
请看我编辑的问题,我实际上想要在用户点击任何缩略图时获取原始大小的图像。 –
你不是在一个数组内存储所有的图像吗?不能得到原始图像是什么意思? – KrishnaCA