Created
November 5, 2014 04:20
-
-
Save ethanbing/3ff9ab56cab5b0edc2fc to your computer and use it in GitHub Desktop.
UICollectionView 点击空白 继续传递事件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
继承并实现 | |
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
[[self nextResponder] touchesBegan:touches withEvent:event]; | |
} | |
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
UITouch * touch = [touches anyObject]; | |
CGPoint touchPoint = [touch locationInView:self]; | |
NSIndexPath * tappedCellPath = [self indexPathForItemAtPoint:touchPoint];//获取点击处的cell的indexPath | |
if (tappedCellPath == nil) { | |
[[self nextResponder] touchesEnded:touches withEvent:event]; | |
}else{ | |
[self.delegate collectionView:self didSelectItemAtIndexPath:tappedCellPath]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment