I have implemented a UICollectionView in my app. My problem is that I need to select (like if the user tapped on it) a cell programmatically.
The method:
- (void)selectItemAtIndexPath:(NSIndexPath *)indexPath 
                     animated:(BOOL)animated 
               scrollPosition:(UICollectionViewScrollPosition)scrollPosition
That is part of the UICollectionView class is not what i need to call, since this method does not call:
- (void)collectionView:(UICollectionView *)collectionView 
        didSelectItemAtIndexPath:(NSIndexPath *)indexPath
It just sets the selected property of the cell to YES;
Yes, this is proper behaviour. Documentation for [selectItemAtIndexPath:animated:scrollPosition:] says:
This method does not cause any selection-related delegate methods to be called.
I am calling [self collectionView:yourView didSelectItemAtIndexPath:yourIndexPath] to programmatically select a cell.  But in the method cell is always nil.  This works perfectly well when user selects a cell.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With