I can\'t get UIScreenEdgePanGestureRecognizer
to work when I create when I add it to my view controller using Interface Builder, so I\'m asking here to establish wh
I set up a project to test your question and found the same issue you did. Here are the scenarios I set up to test:
I did exactly as you did, using Interface Builder, to build the screen edge gesture. The only difference in my code is that I put a line of code in the selector so the debugger would have something to stop on. The debugger failed to halt exactly as you found.
-(void)handlePan:(id)sender
{
NSString *test = @"";
}
I then created an additional gesture using the pinch gesture on the same view using Interface Builder and I was able to get the debugger to halt within that selector. So Interface Builder seems to be able to build other gestures correctly.
In the ViewController.h file I included the UIGestureRecognizerDelegate.
@interface ViewController : UIViewController
@end
In the ViewController.m file I implemented the gesture manually.
#import "ViewController.h"
@interface ViewController ()
-(void)handlePan:(id)sender;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIScreenEdgePanGestureRecognizer *pan = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self
action:@selector(handlePan:)];
[pan setEdges:UIRectEdgeLeft];
[pan setDelegate:self];
[self.view addGestureRecognizer:pan];
}
-(void)handlePan:(id)sender
{
NSString *test = @"";
}
@end
I ended up with the same conclusion you did - there seems to be something wrong with the Interface Builder's implementation of the UIScreenEdgePanGestureRecognizer.