Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Pod/Classes/MWGridCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ - (void)setIsSelected:(BOOL)isSelected {
}

- (void)selectionButtonPressed {

if ([_gridController.browser.delegate respondsToSelector:@selector(photoBrowser:shouldSelectPhotoAtIndex:)]) {
BOOL shouldSelect = [_gridController.browser.delegate photoBrowser:_gridController.browser shouldSelectPhotoAtIndex:_index];
if (!shouldSelect && !_selectedButton.isSelected) {
return;
}
}

_selectedButton.selected = !_selectedButton.selected;
[_gridController.browser setPhotoSelected:_selectedButton.selected atIndex:_index];
}
Expand Down
1 change: 1 addition & 0 deletions Pod/Classes/MWPhotoBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
- (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
- (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
- (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser shouldSelectPhotoAtIndex:(NSUInteger)index;

@end

Expand Down
6 changes: 6 additions & 0 deletions Pod/Classes/MWPhotoBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,12 @@ - (void)selectedButtonTapped:(id)sender {
}
}
if (index != NSUIntegerMax) {
if ([self.delegate respondsToSelector:@selector(photoBrowser:shouldSelectPhotoAtIndex:)]) {
BOOL shouldSelect = [self.delegate photoBrowser:self shouldSelectPhotoAtIndex:index];
if (!shouldSelect && !selectedButton.isSelected) {
return;
}
}
[self setPhotoSelected:selectedButton.selected atIndex:index];
}
}
Expand Down