口袋优选

KBTableView.m 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // KBTableView.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/17.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBTableView.h"
  9. @implementation KBTableView
  10. - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
  11. self = [super initWithFrame:frame style:style];
  12. if (self) {
  13. self.delaysContentTouches = NO;
  14. self.canCancelContentTouches = YES;
  15. self.separatorStyle = UITableViewCellSeparatorStyleNone;
  16. self.backgroundView.backgroundColor = [UIColor clearColor];
  17. self.backgroundColor = [UIColor clearColor];
  18. UIView *wrapView = self.subviews.firstObject;
  19. if (wrapView && [NSStringFromClass(wrapView.class) hasSuffix:@"WrapperView"]) {
  20. for (UIGestureRecognizer *gesture in wrapView.gestureRecognizers) {
  21. if ([NSStringFromClass(gesture.class) containsString:@"DelayedTouchesBegan"]) {
  22. gesture.enabled = NO;
  23. break;
  24. }
  25. }
  26. }
  27. }
  28. return self;
  29. }
  30. - (BOOL)touchesShouldCancelInContentView:(UIView *)view {
  31. if ([view isKindOfClass:[UIControl class]]) {
  32. return YES;
  33. }
  34. return [super touchesShouldCancelInContentView:view];
  35. }
  36. /**
  37. 同时识别多个手势
  38. @param gestureRecognizer gestureRecognizer description
  39. @param otherGestureRecognizer otherGestureRecognizer description
  40. @return return value description
  41. */
  42. - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
  43. {
  44. return NO;
  45. }
  46. @end