Question

as shown in the picture below the UIPanGestureRecognizer will not pan when the drag started inside the "dead zone" on the top of the screen. This is most likely caused by the notification center.

enter image description here

The touchesMoved:withEvent: method however does get called, so there should be a way to get pan gestures recognized in this area.

Has anyone else came across this issue, are there any workarounds out there yet? Thanks for any help!

Was it helpful?

Solution 2

Solved the problem. The touchesMoved:withEvent: should be implemented this way:

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches.allObjects objectAtIndex:0];
    CGPoint location = [touch locationInView:self];
    CGPoint previousLocation = [touch previousLocationInView:self];
    CGPoint contentOffset = self.contentOffset;

    contentOffset.x -= location.x - previousLocation.x;
    [self setContentOffset:contentOffset animated:NO];
}

OTHER TIPS

It is possible that on the top edge of the screen you have multiple gesture recognisers that interferes. It could be that the the other gesture recogniser that interferes is added by system with some UIElement.

Try to implement UIGestureRecognizerDelegate on your gesture recogniser delegate.

Especially this method:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{

     NSLog(@"1st recognizer class: %@ ; 2nd recognizer class: %@", NSStringFromClass([gestureRecognizer class]), NSStringFromClass([otherGestureRecognizer class])); 

     return YES; 

}

https://developer.apple.com/library/ios/documentation/uikit/reference/UIGestureRecognizerDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIGestureRecognizerDelegate/gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top