iOS

Long Standing Bug With Using UIScreenEdgePanGestureRecognizer Created With Xcode Interface Builder

Encountered the same bug when creating a UIScreenEdgePanGestureRecognizer via Interface Builder.

It just didn’t work as expected: the selector is never called.

Other gesture recognizers work. Except panning from edge.

We can only fallback to manually creating it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
- (void)viewDidLoad {
    [super viewDidLoad];
    UIScreenEdgePanGestureRecognizer *leftEdgeGesture = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleLeftEdgeGesture:)];
    leftEdgeGesture.edges = UIRectEdgeLeft;
    leftEdgeGesture.delegate = self;
    [self.view addGestureRecognizer:leftEdgeGesture];
}

- (IBAction)handleLeftEdgeGesture:(UIScreenEdgePanGestureRecognizer *)gesture {
    NSLog(@"panned");
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

Not impressed with a bug that is not fixed for over 6 months.

Comments