我在使用Core Data存储标记有一个用户或一个位置的多个图像时遇到问题。
存储图像或其他媒体类型的最佳实践是什么?核心数据是否可以与大型二进制数据(例如图像或媒体)一起正常工作?
最佳答案
这是功能。
func showImagePickerWithAssetType(assetType:DKImagePickerControllerAssetType,
allowMultipleType:Bool = true,
sourceType:DKImagePickerControllerSourceType = [.Camera,.Photo]){
let pickerController = DKImagePickerController()
pickerController.assetType = assetType
pickerController.allowMultipleTypes = allowMultipleType
pickerController.sourceType = sourceType
pickerController.didCancelled = {
print("didCancelled")
}
pickerController.didSelectedAssets = { [unowned self] (assets: [DKAsset]) in
print("didSelectedAssets")
print(assets.map({ $0.url}))
self.assets = assets
self.previewView?.reloadData()
}
self.presentViewController(pickerController, animated: true) {}
}