views:

903

answers:

3

Hi,

I have a query regarding Dropping Multiple Pins On Map when Co-ordinates are given using Mapkit in iPhone.

Using Mapkit I am able to see the map at given latitude and longitude. I am also able to drop a pin on one particular location.

However I have a array of lat and long and I want to show pins for them all. How to achieve this?

I tried adding [mapView addAnnotation:pin] in loop, each time updating coordinates but it is not working.

Please help in this regard.

A: 

You can do so by a simple logic.

call annotation method in a loop from 0 to your [array count]; you must pass arguments to annotation method ie id, lat and long.

i have done it successfully..

make sure you have include pinmark nsobject class

Aamir

aamir
+2  A: 

Do not using [mapView addAnnotation:pin] in loop,you can use this API: [mapView addAnnotations:pinsArray]. It works for me.

This is a screenshot of my App using multiple pins : Nearby Dovebox

syd
A: 

I m trying to do this but unable to get the result here is my question

http://stackoverflow.com/questions/3837237/multiple-annotations-on-mapkit-for-iphone/3838392#3838392

can you please provide me sample code if possible

STUPID PROGRAMMER