Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit ebce520

Browse files
committed
Adds method to clear current asset selection.
1 parent d28774f commit ebce520

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Pod/Classes/WPMediaPickerViewController.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,5 +165,10 @@
165165
*/
166166
- (void)setGroup:(nonnull id<WPMediaGroup>)group;
167167

168+
/**
169+
* Clears the current asset selection in the picker.
170+
*/
171+
- (void)clearSelectedAssets:(BOOL)animated;
172+
168173
@end
169174

Pod/Classes/WPMediaPickerViewController.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ - (void)setAllowMultipleSelection:(BOOL)allowMultipleSelection
148148
}
149149
}
150150

151+
- (void)clearSelectedAssets:(BOOL)animated
152+
{
153+
for (NSIndexPath *indexPath in [self.collectionView indexPathsForSelectedItems]) {
154+
[self.collectionView deselectItemAtIndexPath:indexPath animated:animated];
155+
}
156+
157+
[self.selectedAssets removeAllObjects];
158+
}
159+
151160
#pragma mark - UICollectionViewDataSource
152161

153162
-(void)updateDataWithRemoved:(NSIndexSet *)removed inserted:(NSIndexSet *)inserted changed:(NSIndexSet *)changed moved:(NSArray<id<WPMediaMove>> *)moves {

0 commit comments

Comments
 (0)