views:

126

answers:

0

Hello. my question is, to set more Annotation Pins on a map?

enter code 
- (NSArray *) addressLocation 
{
kunden = [NSArray arrayWithObjects:@"Kammlach", @"Mindelheim",@"Ettringen", nil];
NSString *aktuellerKunde;
int i;

locations = [NSMutableArray arrayWithObjects:@"",nil];
for (i=0; i < [kunden count]; i++) {
     CLLocationCoordinate2D* location = malloc(sizeof(CLLocationCoordinate2D));
     aktuellerKunde=[kunden objectAtIndex:i];
     NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&amp;output=csv", 
     [aktuellerKunde stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
     NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
     NSArray *listItems = [locationString componentsSeparatedByString:@","];

     double latitude = 0.0;
     double longitude = 0.0;

     if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"]) {
         latitude = [[listItems objectAtIndex:2] doubleValue];
         longitude = [[listItems objectAtIndex:3] doubleValue];
         }
     else {
         //Show error
     }

     location -> latitude = latitude;
     location -> longitude = longitude;

     [locations addObject:[NSData dataWithBytes:(void *)location length:sizeof(CLLocationCoordinate2D)]];
     }
return locations;
}

so this is my code with 3 points i want to set on the map. and what can i do, in the follow method to get this points out of the array into the map??