Swift3 从gallery和camera中选择图像并粘贴到表视图中的图像视图中
我想从gallery和camera中选择图像,并在tableview自定义单元格的imageview中显示它。我可以从“多媒体资料”中选择3幅图像,并使用相机照片在不同的图像视图中显示吗 是的,您可以使用这个很棒的库从图库中选择多个图像 您可以在Swift3 从gallery和camera中选择图像并粘贴到表视图中的图像视图中,swift3,Swift3,我想从gallery和camera中选择图像,并在tableview自定义单元格的imageview中显示它。我可以从“多媒体资料”中选择3幅图像,并使用相机照片在不同的图像视图中显示吗 是的,您可以使用这个很棒的库从图库中选择多个图像 您可以在ui按钮上使用以下代码 var arrImage : [UIImage] = [UIImage]() @IBAction func btnMultipleImage(_ sender: UIButton) { arrImageURL.remo
ui按钮上使用以下代码
var arrImage : [UIImage] = [UIImage]()
@IBAction func btnMultipleImage(_ sender: UIButton) {
arrImageURL.removeAll()
multiplePicker.delegate = self
//multiplePicker.allowMultipleTypes = false
multiplePicker.assetType = .allPhotos
multiplePicker.maxSelectableCount = 4
multiplePicker.didSelectAssets = { (assets: [DKAsset]) in
for asset in assets {
asset.fetchOriginalImageWithCompleteBlock({ (image, info) in
//info[PHImageFileURLKey]
print(image!)
self.arrImage.append(image!)
})
}
}
self.present(self.multiplePicker, animated: true, completion: nil)
}
现在使用此arrImage
在TableView单元格中显示图像
let image = arrImage[indexPath.row]
cell.imgView.image = image
希望这有帮助