Answer the question
In order to leave comments, you need to log in
Issue with touchesEnded override for UICollectionViewCell subclass?
My UICollectionViewCell subclass has a Boolean editingMode property. It is needed so that, among other things, in this "mode" the didSelectItemAtIndexPath event for the UICollectionView delegate does not fire. I override touchesEnded for this subclass like this:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (!_editingMode) {
[super touchesEnded:touches withEvent:event];
}
else {
// My custom behavior
}
}
Answer the question
In order to leave comments, you need to log in
Problem solved.
I rewrote touchesEnded like this:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
if (_editingMode) {
// Do my thing
}
}
GDCollectionViewCell *cell = [collectionView cellForItemAtIndexPath:indexPath];
if (cell.editingMode)
return; // Do nothing in editing mode
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question