UIButton fails to properly register touch in bottom region of iPhone screen UIButton fails to properly register touch in bottom region of iPhone screen ios ios

UIButton fails to properly register touch in bottom region of iPhone screen


The cause for this issue is that Apple seems to place a GestureRecognizer at the bottom of the screen that delays touches in any other view.After fiddling around with gesture recognizers on the App's windows I came up with a solution that incorporates a subclass of UIButton:

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{    BOOL inside = [super pointInside: point withEvent: event];    if (inside && !self.isHighlighted && event.type == UIEventTypeTouches)    {        self.highlighted = YES;    }    return inside;}

The given method is getting called although touchesBegan: is called delayed. A check if the view is at the bottom of the screen may be suitable to prevent any side effects that may occur with this fix.


This sounds like an interaction between the buttons and the UIScreenEdgePanGestureRecognizer (or whatever it is) that is responsible for detecting that the user wants to bring up the system's Control Center.

There are actually two potential issues here:

  • There can be an interaction (i.e. conflict) between the possibility of a gesture directed at your app and a gesture directed at the system. If you have gesture recognizers, you might have to use delegate methods to mediate between them and the system's gesture recognizers.

  • There is a well-established bug where a tap near the screen edge (i.e. in the screen edge gesture recognizer's "zone") works but it causes the button to misbehave physically, i.e. it doesn't look as if it's been tapped even though logging shows that it has (see my answer here: https://stackoverflow.com/a/22000692/341994).


answer of Lukas in swift and deselect highlighted

extension UIButton {  public override func pointInside(point: CGPoint, withEvent event: UIEvent?) -> Bool {    var inside = super.pointInside(point, withEvent: event)    if inside != highlighted && event?.type == .Touches {        highlighted = inside    }    return inside  }}


matomo