How to select map pin when tapping table row that associates with it?

前端 未结 2 798
故里飘歌
故里飘歌 2021-01-28 08:15

Here I have 2 views:

  • WallViewController
  • TableViewController

WallViewController contains MKMapView, and <

2条回答
  •  感情败类
    2021-01-28 08:28

    You can use PFObject.objectId to find annotation what you want.

    PFObject *selectedObject = [self.objects objectAtIndex:i];
    
    for (id annotation in wallViewController.mapView.annotations)
    {
        if ([annotation isKindOfClass:[PAWPost class]])
        {
            PAWPost *post = (PAWPost*)annotation;
            if ([post.object.objectId isEqualToString:selectedObject.objectId])
            {
                [wallViewController.mapView selectAnnotation:annotation  animated:YES];
                break;
            }
        }
    }
    

提交回复
热议问题