Google maps ios 5中在海洋中显示的地图视图
在我升级到ios 5.0之前,我有一个运行良好的应用程序。更新后,地图显示在海洋中。我不确定出了什么问题。 这是我正在使用的代码 [mapView setMapType:MKMapTypeStandard]Google maps ios 5中在海洋中显示的地图视图,google-maps,ios5,mkmapview,mapkit,Google Maps,Ios5,Mkmapview,Mapkit,在我升级到ios 5.0之前,我有一个运行良好的应用程序。更新后,地图显示在海洋中。我不确定出了什么问题。 这是我正在使用的代码 [mapView setMapType:MKMapTypeStandard] [mapView setZoomEnabled:YES]; [mapView setScrollEnabled:YES]; MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } }; region.center.latitude =
[mapView setZoomEnabled:YES];
[mapView setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = deleg.selectedVenue.latitude;
region.center.longitude = deleg.selectedVenue.longitude;
region.span.longitudeDelta = 0.01f;
region.span.latitudeDelta = 0.01f;
[mapView setRegion:region animated:YES];
在ios 5.0中如何正确地执行此操作?
谢谢这是我在iOS5下工作的代码片段。请随时提问
// grab the location from persistent store
CLLocation *loc = [store currentLocation];
CLLocationCoordinate2D zoomLocation;
float zoom;
// it will be NULL on first launch, so initialize to someplace interesting.
if (!loc) {
CLLocationCoordinate2D longPointLightLocation;
longPointLightLocation.latitude = 42.033126;
longPointLightLocation.longitude = -70.168621;
// center the map so the initial zoom when the GPS kicks in is from HERE, not the default
[mapView setCenterCoordinate:longPointLightLocation animated:NO];
zoomLocation = longPointLightLocation;
zoom = 50; // on first launch, zoom way out
} else {
zoomLocation.latitude = loc.coordinate.latitude;
zoomLocation.longitude = loc.coordinate.longitude;
zoom = 2;
}
MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, zoom*METERS_PER_MILE, zoom*METERS_PER_MILE);
[mapView setRegion:[mapView regionThatFits:viewRegion] animated:NO];
检查deleg.SelectedVince是否为有效坐标,例如
if (CLLocationCoordinate2DIsValid(deleg.selectedVenue)) {
// add to your mapView
}
else {
NSLog(@"coordinate is invalid");
}
其中CLLocationCoordinate2DIsValid是在核心位置框架中声明的函数。deleg.selectedVince设置的方式和位置?这段代码是用什么方法编写的?出于某种原因,这里的var可能为零。