12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- //
- // KBCollectionView.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/17.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "KBCollectionView.h"
- @implementation KBCollectionView
- - (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
- self = [super initWithFrame:frame collectionViewLayout:layout];
- if (self) {
- self.delaysContentTouches = NO;
- self.canCancelContentTouches = YES;
- self.backgroundView.backgroundColor = [UIColor clearColor];
- self.backgroundColor = [UIColor clearColor];
-
- UIView *wrapView = self.subviews.firstObject;
- if (wrapView && [NSStringFromClass(wrapView.class) hasSuffix:@"WrapperView"]) {
- for (UIGestureRecognizer *gesture in wrapView.gestureRecognizers) {
- if ([NSStringFromClass(gesture.class) containsString:@"DelayedTouchesBegan"]) {
- gesture.enabled = NO;
- break;
- }
- }
- }
- }
- return self;
- }
- - (BOOL)touchesShouldCancelInContentView:(UIView *)view {
- if ([view isKindOfClass:[UIControl class]]) {
- return YES;
- }
- return [super touchesShouldCancelInContentView:view];
- }
- @end
|