Following is my MapKitDisplayViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
[mapView setMapType:MKMapTypeStandard];
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 22.569722 ;
region.center.longitude = 88.369722;
[mapView setRegion:region animated:YES];
[mapView setDelegate:self];
DisplayMap *ann = [[DisplayMap alloc] init];
ann.title = [person name];
ann.subtitle = [person address];
ann.person = person;
ann.coordinate = region.center;
[mapView addAnnotation:ann];
}
-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:
(id <MKAnnotation>)annotation {
MKPinAnnotationView *pinView = nil;
if(annotation != mapView.userLocation)
{
static NSString *defaultPinID = @"com.invasivecode.pin";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if ( pinView == nil ) pinView = [[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
UIImageView *iconView = [[UIImageView alloc] initWithImage: [UIImage imageWithString:@?????????????????];
annotationView.leftCalloutAccessoryView = iconView;
pinView.pinColor = MKPinAnnotationColorRed;
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
}
return pinView;
}
You will see the line where it’ll say ???????? I need to display an image there.
When the user clicks a pin point, then the popup will appear. Title, subtitle and the image is suppose to be displayed on the popup. I believe that the following line should display the image for that popup. But i am unable to pass the Person object’s (or the pipoint which contains the person object) image URL to this method. Can you help me display the selected Image URL here.
This is what i did, in the
viewForAnnotationmethod