ios - Mapbox Annotation -
i want create multiple annotations different images. create annotations, in viewdidload:
for (int i=0; i<[annotationsarray count]; i++) { rmannotation *annotation = [[rmannotation alloc] initwithmapview:mapview coordinate:cllocationcoordinate2dmake([[latitudearray objectatindex:i] doublevalue], [[longitudearray objectatindex:i] doublevalue]) andtitle:[namearray objectatindex:i]]; [self.mapview addannotation:annotation]; }
in method below, gives every annotation same image:
- (rmmaplayer *)mapview:(rmmapview *)mapview layerforannotation:(rmannotation *)annotation { if (annotation.isuserlocationannotation) { return nil; } rmmarker *marker = [[rmmarker alloc] initwithuiimage:[uiimage imagenamed:@"coffeeshopsicon.png"]]; marker.canshowcallout = yes; marker.leftcalloutaccessoryview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"coffeeshopsicon.png"]]; marker.rightcalloutaccessoryview = [uibutton buttonwithtype:uibuttontypedetaildisclosure]; return marker; }
i have array holds image names. how can achieve issue?
you want use -[rmannotation userinfo]
api.
/** storage arbitrary data. */ @property (nonatomic, strong) id userinfo;
Comments
Post a Comment