Open coder123-star opened 3 years ago
You can do this by delegate the method func assetsPicker(controller: AssetsPickerViewController, shouldSelect asset: PHAsset, at indexPath: IndexPath) -> Bool
to achieve this.
Look like this:
func assetsPicker(controller: AssetsPickerViewController, shouldSelect asset: PHAsset, at indexPath: IndexPath) -> Bool {
if controller.selectedAssets.count >= 1 {
return false
}
return true
}
found solution -
func assetsPicker(controller: AssetsPickerViewController, shouldSelect asset: PHAsset, at indexPath: IndexPath) -> Bool {
// can limit selection count
if asset.mediaType == .video {
if controller.selectedAssets.count > 4 {
return false
}
}
if asset.mediaType == .image {
if controller.selectedAssets.count > 7 {
return false
}
}
return true
}
Similar to an app like twitter I would like to only allow users to upload one video however they can select multiple images and upload them. I don't know how to do this though since there is only maximum and minimum selection for all assets.