I am disabling a UIScrollView when it reaches a particular offset, and would like to re-enable it in a gesture recognizer. The only issue I have is that the scrollview does not get the touch until the the users touch is lifted from the screen.
How can I re-enable the scrollview without lifting a finger?
UIScrollViews category:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}
UIPanGestureRecognizer *gestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
gestureRecognizer.delegate = self;
gestureRecognizer.cancelsTouchesInView = NO;
gestureRecognizer.delaysTouchesBegan = NO;
gestureRecognizer.delaysTouchesEnded = NO;
[self.bodyScrollView addGestureRecognizer:gestureRecognizer];
- (void)handlePanGesture:(UIPanGestureRecognizer *)gesture
{
if (gesture.state == UIGestureRecognizerStateChanged) {
if (self.previousAssetsScrollViewOffset.y == -44
&& !self.bodyScrollView.scrollEnabled && !self.composeScrollView.scrollEnabled) {
self.bodyScrollView.scrollEnabled = YES;
self.composeScrollView.scrollEnabled = YES;
}
}
}