Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
- Reverts to sharing ownership of gesture recognizers between collect…
Browse files Browse the repository at this point in the history
…ion view and layout.
  • Loading branch information
lxcid committed Apr 1, 2013
1 parent e740a3c commit 75601c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

@property (assign, nonatomic) CGFloat scrollingSpeed;
@property (assign, nonatomic) UIEdgeInsets scrollingTriggerEdgeInsets;
@property (weak, nonatomic, readonly) UILongPressGestureRecognizer *longPressGestureRecognizer;
@property (weak, nonatomic, readonly) UIPanGestureRecognizer *panGestureRecognizer;
@property (strong, nonatomic, readonly) UILongPressGestureRecognizer *longPressGestureRecognizer;
@property (strong, nonatomic, readonly) UIPanGestureRecognizer *panGestureRecognizer;

- (void)setUpGestureRecognizersOnCollectionView __attribute__((deprecated("Calls to setUpGestureRecognizersOnCollectionView method are not longer needed as setup are done automatically through KVO.")));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,23 @@ - (void)setDefaults {
}

- (void)setupCollectionView {
UILongPressGestureRecognizer *longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
action:@selector(handleLongPressGesture:)];
longPressGestureRecognizer.delegate = self;
[self.collectionView addGestureRecognizer:longPressGestureRecognizer];
_longPressGestureRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self
action:@selector(handleLongPressGesture:)];
_longPressGestureRecognizer.delegate = self;
[self.collectionView addGestureRecognizer:_longPressGestureRecognizer];

// Links the default long press gesture recognizer to the custom long press gesture recognizer we are creating now
// by enforcing failure dependency so that they doesn't clash.
for (UIGestureRecognizer *gestureRecognizer in self.collectionView.gestureRecognizers) {
if ([gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
[gestureRecognizer requireGestureRecognizerToFail:longPressGestureRecognizer];
[gestureRecognizer requireGestureRecognizerToFail:_longPressGestureRecognizer];
}
}
_longPressGestureRecognizer = longPressGestureRecognizer;

UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePanGesture:)];
panGestureRecognizer.delegate = self;
[self.collectionView addGestureRecognizer:panGestureRecognizer];
_panGestureRecognizer = panGestureRecognizer;
_panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePanGesture:)];
_panGestureRecognizer.delegate = self;
[self.collectionView addGestureRecognizer:_panGestureRecognizer];
}

- (id)init {
Expand Down

0 comments on commit 75601c7

Please sign in to comment.