开发者

show map callout through code in iPhone

开发者 https://www.devze.com 2023-03-19 11:22 出处:网络
I have tried several things but am unable to solve it out. I have 10 custom annotations on the map depending upon the area visible.

I have tried several things but am unable to solve it out.

I have 10 custom annotations on the map depending upon the area visible.

Now I have 2 buttons next and previous. Clicking on which the callout of annotation must get displayed.

i.e if i click on next buton then callout of annotation 1 will appear and when i click next again then the callout of first will hide and callout of second will appear.

I have tried out

[self.mapView selectAnnotation:self.nextSelectedAnnotationView.annotation animated:YES]

and

[self.mapView deselectAnnotation:self.selectedAnnotationView.annotation animated:YES];

But the main problem is how to get the annotation here??

I have tried NSArray* selectedAnnotations=self.mapview.annotations to get the annotations array

id annotationView =[selectedAnnotations objectAtIndex:i];
[self.mapView selectAnnotation:annotationVie开发者_JAVA技巧w animated:YES];

But no luck :(

Any other way to solve my issue.??


it may help you.

 NSArray *selectedAnnotations = mapView.selectedAnnotations;
for(id annotationView in selectedAnnotations) {
    [mapView deselectAnnotation:[annotationView annotation] animated:NO];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号