【发布时间】:2019-07-04 18:33:55
【问题描述】:
我的场景,我正在将照片库照片加载到水平集合视图单元格 Imageview 中。为了快速加载图像,我给了PHImagemanagertargetSize: CGSize(width: 120.0, height: 120.0)。现在,一旦用户在水平 CollectionView 中选择单元格,就需要获取 PHImageManagerMaximumSize 实际的高质量照片以用于预览图像。如何实现?
cell.tag = Int(manager.requestImage(for: asset,
targetSize: CGSize(width: 120.0, height: 120.0), //PHImageManagerMaximumSize
contentMode: .aspectFill,
options: option) { (result, _) in
cell.picImage?.image = result
})
// MARK: - UICollectionViewDelegate protocol
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let selectedCell = collectionView.cellForItem(at: indexPath) as! GalleryCollectionViewCell
previewImage.image = selectedCell.picImage.image // here I need to get full size exact image (not cropped image)
}
【问题讨论】: