@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
注意:手势识别器似乎有完全相同的问题,这就是为什么我尝试使用touchesBegan进行更低级别的 *** 作.
解决方法 您只需将视图设置为背景视图,然后就可以添加手势识别器:collectionVIEw.backgroundVIEw = [[UIVIEw alloc] init];[collectionVIEw.backgroundVIEw addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnBackgroundRecognized)]];总结
以上是内存溢出为你收集整理的ios – 如何在UICollectionView上触摸背景(即不是单元格)?全部内容,希望文章能够帮你解决ios – 如何在UICollectionView上触摸背景(即不是单元格)?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)