我想在CollectionViewCell drawRect方法中为CollectionViewCell类添加一个UIGestureRecognizer,我有:
//Add swipeGestureGecognizer
UISwipeGestureRecognizer* swipeRightGestureRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)];
swipeRightGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;
[self addGestureRecognizer:swipeRightGestureRecognizer];
- (void)handleSwipe:(UISwipeGestureRecognizer*)gestureRecognizer
{
NSLog(@"swipe");
}
但是我没有工作,似乎swipeGestureGecognizer没有添加到单元格