Я предполагаю, что вы отображаете заголовок и субтитры в выноске для аннотации (серое поле, которое появляется, когда вы нажимаете на булавку, если вы используете булавку). Если это так, то у выноски есть два представления, которые вы можете настроить (leftCalloutAccessoryView и rightCalloutAccessoryView (оба установлены в представлении аннотации))
ТАК, что если вы хотите, чтобы изображение отображалось в сером поле над контактом, то при нажатии на контакт вы можете сделать это, настроив вид аннотации с помощью метода делегата, подобного следующему:
-(MKAnnotationView*)mapView:(MKMapView*)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
// If you are showing the users location on the map you don't want to change it
MKAnnotationView *view = nil;
if (annotation != mapView.userLocation) {
// This is not the users location indicator (the blue dot)
view = [mapView dequeueReusableAnnotationViewWithIdentifier:@"myAnnotationIdentifier"];
if (!view) {
// Could not reuse a view ...
// Creating a new annotation view, in this case it still looks like a pin
view = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotationIdentifier"] autorelease];
view.canShowCallOut = YES; // So that the callout can appear
UIImageView *myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"someName"]];
myImageView.frame = CGRectMake(0,0,31,31); // Change the size of the image to fit the callout
// Change this to rightCallout... to move the image to the right side
view.leftCalloutAccessoryView = myImageView;
[myImageView release], myImageView = nil;
}
}
return view;
}
Однако , если все, что вам нужно, это показать много изображений непосредственно на карте (а не в выносках), то вы можете, используя тот же метод делегата, установить свойство image просмотр аннотации, например:
-(MKAnnotationView*)mapView:(MKMapView)mapView viewForAnnotation:(id<MKAnnotation>)annotation {
// If you are showing the users location on the map you don't want to change it
MKAnnotationView *view = nil;
if (annotation != mapView.userLocation) {
// This is not the users location indicator (the blue dot)
view = [mapView dequeueReusableAnnotationViewWithIdentifier:@"myAnnotationIdentifier"];
if (!view) {
// Could not reuse a view ...
// Creating a new annotation view
view = [[[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotationIdentifier"] autorelease];
// This will rescale the annotation view to fit the image
view.image = [UIImage imageNamed:@"someName"];
}
}
return view;
}
Я надеюсь, что ответ на ваш вопрос