MapView崩溃

时间:2012-07-03 14:59:38

标签: ios mkmapview

我一直在将MapView添加到我的ViewController中。代码如下:

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];返回错误,我认为它无法初始化mapview,任何人都可以帮忙吗?

1 个答案:

答案 0 :(得分:2)

我已经解决了我的问题......经纬度正在逆转。 [myStore.Location objectAtIndex:0]应该是经度,而[myStore.Location objectAtIndex:1]应该是纬度......愚蠢的我。

相关问题