我使用自己的UICollectionView子类和单元格等运行UICollectionView控制器。
1)现在我决定按照自己的collectionview控制器后面http://www.raywenderlich.com/32054/how-to-create-a-slide-out-navigation-like-facebook-and-path中的解释添加slideView。 2)然后我不开心,因为它没有给我"峰值内部"感觉像iOS上的FaceBook应用程序
3)然后我在我自己的collectionView子类中修改了代码并处理了触摸。通过这个网站和一些初步的斗争后,我现在可以得到像FB一样的感觉
4)但是在处理触摸的过程中我丢失了UICollectionViewDelegate didSelectItemAtIndePath。他们永远不会因为触摸而被召唤。
5)所以我在故事板上的collectionView上添加了tapGesture并将所有内容挂钩并进行了明确的调用
- (IBAction)selectCellWithSingleTap:(UITapGestureRecognizer *)sender
{
NSLog(@"SELECT");
CGPoint tapLocation = [sender locationInView:self.collectionView];
NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:tapLocation];
if (indexPath) {
[self collectionView:self.collectionView didSelectItemAtIndexPath:indexPath];
}
}
1)现在这是正确的做法吗? 2)如果没有什么是更好的设计? 3)我也想知道这个方法做什么selectItemAtIndexPath:animated:scrollPosition:在UICollectionView中我可以使用这个吗?