Skip to content

Overlapping annotations and touch propagation #15

Open
@gotomanners

Description

@gotomanners

When annotations overlap, the touch events on the top most annotation gets sent to the underlying annotations so it is sometimes impossible to select an annotation to expand and shrink or even use the disclosure button without triggering the annotation(s) underneath.

Have you encountered this?

annotationbug

Code to reproduce

- (NSArray *)annotations {
    // Empire State Building
    JPSThumbnail *empire = [[JPSThumbnail alloc] init];
    empire.image = [UIImage imageNamed:@"empire.jpg"];
    empire.title = @"Empire State Building";
    empire.subtitle = @"NYC Landmark";
    empire.coordinate = CLLocationCoordinate2DMake(40.75f, -73.99f);
    empire.disclosureBlock = ^{ NSLog(@"selected Empire"); };

    // Apple HQ
    JPSThumbnail *apple = [[JPSThumbnail alloc] init];
    apple.image = [UIImage imageNamed:@"apple.jpg"];
    apple.title = @"Apple HQ 1";
    apple.subtitle = @"Apple Headquarters 1";
    apple.coordinate = CLLocationCoordinate2DMake(37.33f, -122.03f);
    apple.disclosureBlock = ^{ NSLog(@"selected Appple"); };

    JPSThumbnail *apple2 = [[JPSThumbnail alloc] init];
    apple2.image = [UIImage imageNamed:@"apple.jpg"];
    apple2.title = @"Apple HQ 2";
    apple2.subtitle = @"Apple Headquarters 2";
    apple2.coordinate = CLLocationCoordinate2DMake(37.34f, -123.03f);
    apple2.disclosureBlock = ^{ NSLog(@"selected Appple 2"); };

    JPSThumbnail *apple3 = [[JPSThumbnail alloc] init];
    apple3.image = [UIImage imageNamed:@"apple.jpg"];
    apple3.title = @"Apple HQ 3";
    apple3.subtitle = @"Apple Headquarters 3";
    apple3.coordinate = CLLocationCoordinate2DMake(37.35f, -113.03f);
    apple3.disclosureBlock = ^{ NSLog(@"selected Appple 3"); };

    // Parliament of Canada
    JPSThumbnail *ottawa = [[JPSThumbnail alloc] init];
    ottawa.image = [UIImage imageNamed:@"ottawa.jpg"];
    ottawa.title = @"Parliament of Canada";
    ottawa.subtitle = @"Oh Canada!";
    ottawa.coordinate = CLLocationCoordinate2DMake(45.43f, -75.70f);
    ottawa.disclosureBlock = ^{ NSLog(@"selected Ottawa"); };

    return @[[JPSThumbnailAnnotation annotationWithThumbnail:empire],
             [JPSThumbnailAnnotation annotationWithThumbnail:apple],
             [JPSThumbnailAnnotation annotationWithThumbnail:apple2],
             [JPSThumbnailAnnotation annotationWithThumbnail:apple3],
             [JPSThumbnailAnnotation annotationWithThumbnail:ottawa]];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions