ios - Make path with RMShape and RMMapView -
i implementing map application using mapbox sdk. need show marker , path together, google around still not main thought this.
so far have done...
- (rmmaplayer *)mapview:(rmmapview *)amapview layerforannotation:(rmannotation *)annotation { rmmarker *marker = [[rmmarker alloc] initwithuiimage:[uiimage imagenamed:@"pin-blue.png"]]; if ([annotation iskindofclass:[myannotation class]]) { if ([annotation.annotationtype isequaltostring:@"marker"]) { [marker replaceuiimage:[self imagewithimage:[uiimage imagenamed:@"ic_marker.png"] scaledtosize:cgsizemake(32, 48)]]; [marker setanchorpoint:cgpointmake(0.5, 1)]; homecoming marker; } else if ([annotation.annotationtype isequaltostring:@"path"]) { path.linewidth = 3; (int i=0; i<[mycoordinatearray count]; i++) { nslog(@"my coord count : %d", [mycoordinatearray count]); cllocationcoordinate2d myloc = [[mycoordinatearray objectatindex:i] coordinate]; if (i>0) { [path addlinetocoordinate:myloc]; } else { [path movetocoordinate:myloc]; } } [path closepath]; homecoming path; } } homecoming nil;
}
//add annotation
mypin = [[myannotation alloc] init]; [mypin setmapview:mapview]; [mypin setcoordinate:mylatlng]; [mypin settitle:@"marker"]; mypin.annotationtype = @"marker"; [mapview addannotation:mypin]; [mapview setneedsdisplay]; mypath = [[myannotation alloc] init]; [mypath setcoordinate:mylatlng]; mypath.annotationtype = @"path"; [mapview addannotation:mypath];
did wrong, or did miss something? please help. in advance.
first, in sec code block, don't need calls setmapview:
or setneedsdisplay
.
second, not working this? code looks should work , show both point , path on map.
ios map path annotations mapbox
No comments:
Post a Comment