UICollectionView をサブクラス化し、 and をオーバーライドしようとしましtouchesBegan:withEvent:
たhitTest:WithEvent:
が、セルに触れるとこれらのメソッドの両方がトリガーされます。しかし、細胞と細胞の間を触っても何も起こりません。ここに私が作成したものがあります:
@interface WSImageGalleryCollectionView : UICollectionView
@end
..と..
@implementation WSImageGalleryCollectionView
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"Touches began");
[super touchesBegan:touches withEvent:event];
}
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSLog(@"Hit test reached");
return [super hitTest:point withEvent:event];
}
@end
注: ジェスチャ レコグナイザーにもまったく同じ問題があるようです。