mirror of
https://github.com/Instagram/IGListKit
synced 2026-05-05 22:48:21 +00:00
Add shouldDeselectItemAtIndex to IGListSectionController
Summary: Add `shouldDeselectItemAtIndex:` to `IGListSectionController`. `shouldSelectItemAtIndex:` already exists, but its inverse does not. Reviewed By: lorixx Differential Revision: D34727371 fbshipit-source-id: ba4e0917380e1b3ff189dad7977ac5c1caa9b714
This commit is contained in:
parent
b6d1a96c08
commit
b22a10e47f
4 changed files with 21 additions and 2 deletions
|
|
@ -60,10 +60,11 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag
|
|||
```
|
||||
|
||||
### Enhancements
|
||||
- Added `shouldDeselectItemAtIndex:` to `IGListSectionController` . [bladeofky](https://github.com/bladeofky)
|
||||
|
||||
- Added `shouldSelectItemAtIndex:` to `IGListSectionController` . [dirtmelon](https://github.com/dirtmelon)
|
||||
|
||||
- Added [Mac Catalyst](https://developer.apple.com/mac-catalyst/) support. [Petro Rovenskyy](https://github.com/3a4oT/)
|
||||
- Added [Mac Catalyst](https://developer.apple.com/mac-catalyst/) support. [Petro Rovenskyy](https://github.com/3a4oT/)
|
||||
|
||||
- Introduce `IGListSwiftKit`, with Swift refinements for `dequeueReusableCellOfClass` methods. [Koen Punt](https://github.com/koenpunt) [(#1388)](https://github.com/Instagram/IGListKit/pull/1388).
|
||||
|
||||
|
|
@ -85,7 +86,7 @@ The changelog for `IGListKit`. Also see the [releases](https://github.com/instag
|
|||
- Schedules an update block (`dispatch_async`) only when needed, instead of scheduling on every single call to `-performUpdateWithCollectionViewBlock`.
|
||||
- Wraps each update in a `transaction` that can be easily cancelled.
|
||||
- Uses methods instead of blocks to make the callstack easier to read in crash reports.
|
||||
- Unblocks `IGListExperimentBackgroundDiffing`
|
||||
- Unblocks `IGListExperimentBackgroundDiffing`
|
||||
|
||||
### Fixes
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,15 @@ NS_SWIFT_NAME(ListSectionController)
|
|||
*/
|
||||
- (BOOL)shouldSelectItemAtIndex:(NSInteger)index;
|
||||
|
||||
/**
|
||||
Asks the section controller if the cell at the specified index path should be deselected
|
||||
|
||||
@param index The index of cell to be deselected.
|
||||
|
||||
@note The default implementation returns YES. **Calling super is not required.**
|
||||
*/
|
||||
- (BOOL)shouldDeselectItemAtIndex:(NSInteger)index;
|
||||
|
||||
/**
|
||||
Tells the section controller that the cell at the specified index path was selected.
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,10 @@ void IGListSectionControllerPopThread(void) {
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)shouldDeselectItemAtIndex:(NSInteger)index {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)didSelectItemAtIndex:(NSInteger)index {}
|
||||
|
||||
- (void)didDeselectItemAtIndex:(NSInteger)index {}
|
||||
|
|
|
|||
|
|
@ -127,6 +127,11 @@
|
|||
return [sectionController shouldSelectItemAtIndex:indexPath.item];
|
||||
}
|
||||
|
||||
- (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
IGListSectionController * sectionController = [self sectionControllerForSection:indexPath.section];
|
||||
return [sectionController shouldDeselectItemAtIndex:indexPath.item];
|
||||
}
|
||||
|
||||
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
||||
// forward this method to the delegate b/c this implementation will steal the message from the proxy
|
||||
id<UICollectionViewDelegate> collectionViewDelegate = self.collectionViewDelegate;
|
||||
|
|
|
|||
Loading…
Reference in a new issue