0

I am trying out a nifty obj-c/ios app i found at http://tech.pro/tutorial/975/building-an-earthquake-monitor-for-iphone-using-mapkit. It maps out earthquakes

It works fine, but I wanted add title and subtitle to the pins. No go. The problem appears to be that the interface only accepts values from the scanned file!! I fail when I try to add extra fields. The thing is, I know they are there in the array. By appearances, they just don't carry forward. Here's what I mean: NSLog: Event contains: 36.238, 69.520, 4.200, 91.0

I expected this: NSLog: Event contains: Scale 4.200 36.238, 69.520, 4.200, 91.0

It was is produced by this:

while ([scanner isAtEnd] == NO) {
        [scanner scanUpToString:@"\n" intoString:&line];
        //skip the first line
        if(count > 0) {
            values = [line componentsSeparatedByString:@","];
            event = [[SeismicEvent alloc] init];
            event.title = @"Scale";
            assert(event.title);
            event.subtitle = [values objectAtIndex:4];
            assert(event.subtitle);
            event.latitude = [[values objectAtIndex:2] floatValue];
            event.longitude = [[values objectAtIndex:3] floatValue];
            event.magnitude = [[values objectAtIndex:4] floatValue];
            event.depth = [[values objectAtIndex:5] floatValue];
            NSLog(@" Event contains: %@", event);
            [eventPoints addObject:event];

reading this: Date,TimeUTC,Latitude,Longitude,Magnitude,Depth 2013/06/28,07:45:23.0,-22.795,171.317,4.9, 35 2013/06/28,07:27:54.1, 3.917,126.013,4.7, 62

I can NSLog the fields; the values are there, they just don't make it anywhere. I'm stumped.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
David
  • 23
  • 3

1 Answers1

0
NSLog(@" Event contains: %@", event);

calls [event description] to convert the custom object into a string.

So I assume that the SeismicEvent class overrides that method and you can change the implementation to show all the fields that you want.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382