I am developing an app for chating, I have to display all friends on a Map with their image. Please provide guidance to implement it.
I have used following code...>
try this code..just..
annotationView.image=[UIImage imageNamed:@"red_point.png"];
and remove annView.animatesDrop = TRUE;
code
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation {
//Define our reuse indentifier.
static NSString *identifier = @"MapPoint";
if ([annotation isKindOfClass:[MapPoint class]]) {
MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [self.map dequeueReusableAnnotationViewWithIdentifier:identifier];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annotationView.leftCalloutAccessoryView=detailButton;
annotationView.image=[UIImage imageNamed:@"red_point.png"];
} else {
annotationView.annotation = annotation;
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
return annotationView;
}
return nil;
}
eidted:
MKPinAnnotationView *annView = [[MKPinAnnotationView alloc]init];
UIButton *detailButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
annView.leftCalloutAccessoryView=detailButton;
annView.image=[UIImage imageNamed:@"Done.png"];
annView.canShowCallout = YES;
annView.calloutOffset = CGPointMake(-5, 5);
[annView addSubview:imageView];