Ich hänge da jetzt schon seit ein paar Tagen fest. So langsam gehen mir die Ideen aus.
Ich will auf einer Karte 1-n Strecken anzeigen. Jeder Startpunkt einer Strecke soll das gleiche custom.image bekommen. Im Titel der Annotation stehen Streckentypische Informationen
Ich will alle Annotions anzeigen.
Das solle mit
funktionieren.
Irgendetwas mache ich falsch, denn es werden zwar alle Strecken und Custom-Imagaes angezeigt (Bild1) ,aber die Titel erscheinen erst, wenn man auf den Startpunkt einer Strecke tippt (Bilder 2&3).
1.png 2.png 3.png
so baue ich die Map auf:
Alles anzeigen
Alles anzeigen
HUPointAnnotation.h
HUPointAnnotation.m
wie bekomme ich das hin, dass alle Titel angezeigt werden?
Ich will auf einer Karte 1-n Strecken anzeigen. Jeder Startpunkt einer Strecke soll das gleiche custom.image bekommen. Im Titel der Annotation stehen Streckentypische Informationen
Ich will alle Annotions anzeigen.
Das solle mit
funktionieren.
Irgendetwas mache ich falsch, denn es werden zwar alle Strecken und Custom-Imagaes angezeigt (Bild1) ,aber die Titel erscheinen erst, wenn man auf den Startpunkt einer Strecke tippt (Bilder 2&3).
1.png 2.png 3.png
so baue ich die Map auf:
C-Quellcode
- for(NSDictionary *dict in trackingArray)
- {
- CLLocationCoordinate2D startCoordinate;
- startCoordinate.latitude = [[dict objectForKey:@"LatitudeVon"]floatValue];
- startCoordinate.longitude = [[dict objectForKey:@"LongitudeVon"]floatValue];
- CLLocationCoordinate2D endCoordinate;
- endCoordinate.latitude = [[dict objectForKey:@"LatitudeBis"]floatValue];
- endCoordinate.longitude = [[dict objectForKey:@"LongitudeBis"]floatValue];
- float distance = [self distance:[[dict objectForKey:@"LatitudeVon"]floatValue]
- fromLongitude:[[dict objectForKey:@"LongitudeVon"]floatValue]
- toLatitude:[[dict objectForKey:@"LatitudeBis"]floatValue]
- toLongitude:[[dict objectForKey:@"LongitudeBis"]floatValue]];
- HUPointAnnotation *startMarker = [[HUPointAnnotation alloc] init];
- startMarker.coordinate = startCoordinate;
- startMarker.title = [NSString stringWithFormat:@"%@ %4.0f m",clubName, distance];
- startMarker.imageName = @"golfer.png";
- [self.mapView addAnnotation:startMarker];
- CLLocationCoordinate2D points[2];
- points[0] = endCoordinate;
- points[1] = startCoordinate;
- MKPolyline *polyLine=[MKPolyline polylineWithCoordinates:points count:2];
- [self.mapView addOverlay:polyLine];
- }
- [self.mapView showAnnotations:self.mapView.annotations animated:NO];
Quellcode
- - (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id<MKAnnotation>)annotation
- {
- if ([annotation isKindOfClass:[MKUserLocation class]])
- return nil;
- if ([annotation isKindOfClass:[HUPointAnnotation class]])
- {
- HUPointAnnotation *customAnnotation = annotation;
- static NSString *annotationIdentifier = @"MyAnnotation";
- MKAnnotationView *annotationView = [theMapView dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
- if (!annotationView)
- {
- annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:annotationIdentifier];
- annotationView.canShowCallout = YES;
- }
- else
- {
- annotationView.annotation = annotation;
- }
- annotationView.image = [UIImage imageNamed:customAnnotation.imageName];
- //[annotationView setAnnotation:customAnnotation];
- return annotationView;
- }
- return nil;
- }
wie bekomme ich das hin, dass alle Titel angezeigt werden?
Ich habe auch keine Loesung, aber ich bewundere das Problem!
_____________________________________________________
Hape42
_____________________________________________________
Hape42