- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation{
MKPinAnnotationView *pinView = nil;
static NSString *defaultPinID = @"CameraAnnotation";
pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (pinView == nil)
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];
UIImageView *pinImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 24, 32)];
UIImage *pinImage = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pinImage" ofType:@"png"]];
pinImageView.image = pinImage;
[pinImage release];
[pinView addSubview:pinImageView];
[pinImageView release];
pinView.canShowCallout = YES;
pinView.animatesDrop = YES;
UIButton* photoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
photoButton.tag = ((PinAnnotationView*)annotation).tag;
pinView.leftCalloutAccessoryView = photoButton;
return pinView;
}
}
désolé, je ne sais pas est-ce ma faute ou non, mais mon programme se bloque à photoButton.tag = ((PinAnnotationView *) annotation) .tag; – Saawan
OK j'ai commenté cela et maintenant le cela a fonctionné mais le problème est que je montre également la broche et alors mon image dessus (mon image est petite si le dos est visible) ... – Saawan
yaar me n'utilisent jamais avant mais je sais qu'il est travailler parce que je vois son fonctionnement et nous téléchargeons ce code pour app store pour l'application de chat – GhostRider