2

I ran into a pretty annoying issue here involving UIScreenEdgePanGestureRecognizerand UIButton interactions.

Here the context: I am developing an Ipad app. The view of my UIViewController contains a lot of UIButton's both at its very top and bottom. I realized after a while that, when being pressed at specific location, the UIButton's weren't behaving as usual. Taking the top row as an example, when the button is pressed at a location really close from the edge of the screen, the event linked to that button would take around .5 second to be triggered. I can also visually see it as the button takes time to be highlighted.

What the cause is: I did a bit of research and from what I could read from this post there is apparently a "conflict between the possibility of a gesture directed at your app and a gesture directed at the system". Basically as the user tap near the edges of the screen, the device is waiting for the user to swipe down or up (using UIScreenEdgePanGestureRecognizer, for example) and that is most likely why I get this delay with my UIButton's.

Now: All the posts regarding this issue are a little bit outdated. I tried different work-around and "not-that-convenient" solution:

i.e. Subclassing my UIButton's to allow the touch to "bypass" UIScreenEdgePanGestureRecognizer with the following method:

-(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
    BOOL pointInside = [super pointInside: point withEvent: event];
    for (UIButton *view in self.subviews) {

            if (CGRectContainsPoint(view.frame, point)) pointInside = YES;

            return pointInside;
        }
    }
    return NO;
}

But in vain, still doesn't fix the issue.

I am wondering if anyone came up with an easy solution to that ? Or maybe Apple did a fix ? Any suggestions / solutions / comments would be greatly appreciated folks!

Community
  • 1
  • 1

0 Answers0