i know its been asked before lots of times, but i just cant seem to get it. i have my map drawn, i have annotations added, and i would like to add disclosure buttons to the annotations.
i am adding the annotations from an array in my viewdidload method by pulling in from a text file
NSURL *dataUrl = [NSURL URLWithString:@"http://nne.ezadspro.co.uk/cms/testmap.txt"];
NSString *fileString = [NSString stringWithContentsOfURL:dataUrl
encoding:NSUTF8StringEncoding
error:nil];
int count = 0;
NSScanner *scanner = [NSScanner scannerWithString:fileString];
eventPoints = [[NSMutableArray array] retain];
Locations *event;
NSString *line;
NSArray *values;
while ([scanner isAtEnd] == NO) {
[scanner scanUpToString:@"\n" intoString:&line];
//skip the first line
if(count > 0) {
values = [line componentsSeparatedByString:@","];
event = [[[Locations alloc] init] autorelease];
event.latitude = [[values objectAtIndex:5] floatValue];
event.longitude = [[values objectAtIndex:6] floatValue];
//event.companyID = [[values objectAtIndex:0]intValue];
event.title = [values objectAtIndex:1];
event.subtitle = [values objectAtIndex:2];
//event.magnitude = [[values objectAtIndex:4] floatValue];
//event.depth = [[values objectAtIndex:5] floatValue];
[eventPoints addObject:event];
}
count++;
if(count == 300) {
//limit number of events to 300
break;
}
}
//UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
[mapView addAnnotations: eventPoints];
this works fine , but like i said i want to add the buttons, now i have seen in multiple threads people talking about the method - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation {
but whatever i do with this method does not seem to work, could someone please help me on how i get it to work(how is it called?) i have no idea
i am fairly new to this so make it simple if you can and ill try not to ask too many questions :)