J'ai créé une annotation pour la forme
_path = [RMAnnotation annotationWithMapView:_mapView coordinate: _userLocation.coordinate andTitle:@"Path"]; [_mapView addAnnotation:_path];
en délégué j'ai écrit
- (RMMapLayer *)mapView:(RMMapView *)mapView layerForAnnotation:(RMAnnotation *)annotation { if ([annotation.title isEqualToSsortingng:@"Path"]) { _lineBetweenTwoBeacon = [[RMShape alloc] initWithView:mapView]; _lineBetweenTwoBeacon.lineColor = [UIColor redColor]; _lineBetweenTwoBeacon.lineWidth = 10.0f; return _lineBetweenTwoBeacon; } else { marker = [[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"userPin"]]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 80, 80)]; imageView.contentMode = UIViewContentModeScaleAspectFit; marker.leftCalloutAccessoryView = imageView; return marker; } }
Prochaine étape je dessine la forme
[_lineBetweenTwoBeacon addQuadCurveToCoordinate:firstBeaconCoord controlCoordinate:secondBeaconCoord];
Mais comment supprimer toutes les forms de la carte et append une nouvelle forme. Maintenant, la forme repose sur la forme, ce n'est pas correct. Sera mieux si _lineBetweenTwoBeacon redessine à chaque fois.
Merci pour l'aide!
Lorsque vous créez manuellement un RMShape
, vous devez lui indiquer où déplacer et dessiner après l'avoir créé avec des methods telles que -moveToCoordinate:
et -addLineToCoordinate:
Si vous avez juste besoin de base, je reorderais d'essayer RMPolylineAnnotation
, qui gère le dessin pour vous.