Edge Pan

This is next entry of Drag and Drop
In iOS7, Edge gesture recognizer is coming.
Edge pan means that to detect tap at the edge and swipe any direction.
Edge is view edge which is target.
We need to set place whether left or right edge.(UIRectEdgeLeft, UIRectEdgeRight)



#pragma mark -
#pragma mark - Edge Pan
-(void)edgePan {
    CGRect rect = CGRectMake(10, 150, 300, 100);
    UIView *panView = [[UIView alloc] initWithFrame:rect];
    [panView setBackgroundColor:[UIColor greenColor]];
    [self.view addSubview:panView];

    // Target is not correct
    UIScreenEdgePanGestureRecognizer *gestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(userDidPan:)];
    gestureRecognizer.edges = UIRectEdgeLeft;  // Just left eadge pan when pointing left edge, work
    [panView addGestureRecognizer:gestureRecognizer];

-(void)userDidPan:(UIScreenEdgePanGestureRecognizer *)recognizer {
    CGPoint location = [recognizer locationInView:self.parentViewController.view];
    CGPoint velocity = [recognizer velocityInView:self.parentViewController.view];
    NSLog(@"Pan x %f, y %f vx %f vy %f", location.x, location.y, velocity.x, velocity.y);
    if (recognizer.state == UIGestureRecognizerStateBegan) {
    else if (recognizer.state == UIGestureRecognizerStateChanged) {
    else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) {


Log when detecting the left edge swipe.
Edge Swipe