I use geocode.And I try to set animate:YES everywhere and It didn't help.
here is my code
@map.m
mapView = [[MKMapView alloc] initWithFrame:self.view.bounds];
mapView.delegate = self;
mapView.mapType = MKMapTypeStandard;
CLLocatio开发者_Go百科nCoordinate2D coord = {latitude: lat, longitude : lon};
MKCoordinateSpan span = {latitudeDelta: 0.001, longitudeDelta: 0.001};
MKCoordinateRegion region = {coord, span};
[mapView setRegion:region animated:YES];
[self.view addSubview:mapView];
MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coord];
[geocoder setDelegate:self];
[geocoder start];
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
mapPlacemark=placemark;
[mapView addAnnotation:placemark];
}
please help me or guide me.very thx . . . .
Thank you for answer. Here is the reesult of code
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
mapPlacemark=placemark;
[mapView selectAnnotation:placemark animated:YES]; //Use this code.
//[mapView addAnnotation:placemark]; << Don't use this code
}
Try this to select the annotation.
[mapView selectAnnotation:yourAnnotation animated:YES];
Here is the Apple reference
Make sure you have enabled the callout for the pin.
精彩评论