我正在尝试在http://tech.pro/tutorial/975/building-an-earthquake-monitor-for-iphone-using-mapkit找到的漂亮的obj-c / ios应用程序。它映射出地震
它工作正常,但我想在引脚上添加标题和副标题。不行。问题似乎是接口只接受扫描文件中的值!当我尝试添加额外的字段时,我失败了。问题是,我知道他们在阵列中。通过外表,他们只是没有发扬光大。 这就是我的意思: NSLog:事件包含:36.238,69.520,4.200,91.0
我期待这个: NSLog:事件包含:比例4.200 36.238,69.520,4.200,91.0
它是由此产生的:
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];
阅读本文: 日期,TimeUTC,经纬度,震级,深度 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
我可以NSLog字段;价值观在那里,他们只是不在任何地方。我很难过。
答案 0 :(得分:0)
NSLog(@" Event contains: %@", event);
调用[event description]
将自定义对象转换为字符串。
所以我假设SeismicEvent
类重写了该方法
并且您可以更改实现以显示所需的所有字段。