I want to find the touched cell index number in collection view controller from out side its delegate methods. I want to create a method which helps me to find out the index no. but my problem is how can I find the cell index.
If is this possible then please provide me the code also.
Thank you.
Anonymous User
01-Jan-2016Yes, you can get the cell index no. with the help of UITapGestureRecognizer. You need to add the gesture recognizer on the cell view. Use gesture recognizer like this:
above code we are adding gesture recognizer on cellImage reference. here cellImage is the reference of UIImageView which will be added on the cell view. and also we are using didImageSelect: method on the @selector.
now, here is the @selector didImageSelect: method code which will be responsible for getting cell index:
now, we get the cell index on the click on any cell in collection view on the indexPath variable.