在地图视图上显示感兴趣的位置,它是多个位置。
MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init];
annotation.coordinate = CLLocationCoordinate2DMake([[[[InterestedLocationsAry objectAtIndex:i] objectForKey:@"Location"] objectForKey:@"latitude"] floatValue], [[[[InterestedLocationsAry objectAtIndex:i] objectForKey:@"Location"] objectForKey:@"longitude"] floatValue]);
annotation.title = [[[InterestedLocationsAry objectAtIndex:i] objectForKey:@"Location"] objectForKey:@"name"];
[mapView selectAnnotation:annotation animated:YES];
[mapView addAnnotation:annotation];其在mapview上显示精确。在select pinpoints上,它不显示MKPointAnnotation的弹出框。
发布于 2014-10-16 18:04:56
您的代码非常完美,只需交换这一行
[mapView selectAnnotation:annotation animated:YES];
[mapView addAnnotation:annotation];再运行一次,
[mapView addAnnotation:annotation];
[self performSelector:@selector(selectAnnoation:) withObject:annotation afterDelay:0.1];
- (void)selectAnnoation:(Annotation *)annotation {
if(annotation)
[mapView selectAnnotation:annotation animated:YES];
}https://stackoverflow.com/questions/26399744
复制相似问题