我有一个地图视图,其中用户位置被跟踪,我试图将用户位置坐标添加到数组中,并将它们显示在文本视图中作为测试,但最近的坐标正在显示,我希望它们在textview中显示为一个列表,类似于NSlog。我想我错过了什么,但不知道是什么。添加更新坐标到NSMutableArray
_trackLat = [NSString stringWithFormat:@"%f",newLocation.coordinate.latitude];
_trackLong = [NSString stringWithFormat:@"%f",newLocation.coordinate.longitude];
_trackCoord = [NSString stringWithFormat:@"%@, %@", _trackLat, _trackLong];
_trackArray = [[NSMutableArray alloc] initWithObjects:_trackCoord, nil];
self.textView.text = self.trackCoord;
NSLog(@"coord lat = %f, coord long: %f",newLocation.coordinate.latitude, newLocation.coordinate.longitude);
我不认为你可以传递一个NSArray类型的指针到setText:这会给你至少一个编译器警告! – hacker2007
@ hacker2007谢谢指出,这是早!我忘了描述必须明确地在这里调用,因为这不是日志。 –