我有一个注释显示在mapkit与自定义图像,显示正常,
默认情况下,如何显示注释?当我启动视图时?点击打印头.
- (MKAnnotationView *)mapView:(MKMapView *)mv viewForAnnotation:(id <MKAnnotation>)annotation { if([annotation isKindOfClass:[MKUserLocation class]]) return nil; NSString *annotationIdentifier = @"PinViewAnnotation"; MKPinAnnotationView *pinView = (MKPinAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier]; if (!pinView) { pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier] autorelease]; [pinView setPinColor:MKPinAnnotationColorGreen]; pinView.animatesDrop = YES; pinView.canShowCallout = YES; UIImageView *houseIconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tijereta.png"]]; pinView.leftCalloutAccessoryView = houseIconView; [houseIconView release]; } else { pinView.annotation = annotation; } return pinView; }
谢谢
解决方法
你可以使用这个
[mapView selectAnnotation:pinView animated:YES]; //这里pinView是你的注释,mapview是你的地图
希望有所帮助