我一直在我的ViewController中添加MapView。代码如下:
MapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
MKCoordinateRegion region;
region.center.latitude = [[myStore.Location objectAtIndex:0] doubleValue];
region.center.longitude = [[myStore.Location objectAtIndex:1] doubleValue];
MKCoordinateSpan span;
span.latitudeDelta = .0015;
span.longitudeDelta = .0015;
region.span = span;
[MapView setRegion:region animated:YES];myStore.Location是一个带有坐标的数组。XCode只是使应用程序崩溃,并在[MapView setRegion:region animated:YES];返回错误,我假设它不能初始化地图视图,有人能帮助吗?
发布于 2012-07-08 10:29:20
我已经解决了我的问题。纬度和经度是颠倒的。[myStore.Location objectAtIndex:0]应该是经度,[myStore.Location objectAtIndex:1]应该是纬度...我真傻。
https://stackoverflow.com/questions/11313702
复制相似问题