PDA

View Full Version : iOS: How to create multiple Annotations



MeltingElements
04.07.2014, 11:56
Hello,

I want to create multiple annotations in my app. So there is a for loop and I want multiple Annoations while the loop is running.

How can I do that?

My current code:

for(int i=0;i < latitude.count; i++)
{
//set the map region
SKCoordinateRegion region;
region.center = CLLocationCoordinate2DMake([self.Latitude[i] floatValue], [self.Longitude[i] floatValue]);
region.zoomLevel = 5;
self.miniMap.visibleRegion = region;

//add a circle overlay
SKAnnotation *annotation = [SKAnnotation annotation];
annotation.identifier = 10;
annotation.annotationType = SKAnnotationTypeRed;
annotation.location = CLLocationCoordinate2DMake([self.Latitude[i] floatValue], [self.Longitude[i] floatValue]);
[self.miniMap addAnnotation:annotation];
}


EDIT:

Ok get it with annotation.identifier = i

SOLVED!