Somojojojo
Somojojojo

Reputation: 278

UICollectionView always one item behind

I have a UICollectionViewController, created in a storyboard, and I have the delegate method 'didDeselectItemAtIndexPath'. However, when this method fires it always returns the indexPath from the previous touch. Ultimately, this means the first touch results in nothing happening.

Example:
- User touches cell 2, nothing happens
- User touches cell 5, cell 2 is returned
- User touches cell 3, cell 5 is returned

Upvotes: 0

Views: 233

Answers (1)

Güngör Basa
Güngör Basa

Reputation: 628

It is normal. You are using "didDeselectItemAtIndexPath". That means you chose something first then when you choose another thing it fires. You should use "didSelectItemAtIndexPath" and everything is gonna be fine.

Upvotes: 8

Related Questions