在我的应用程序中,我显示使用MKMapView地图视图上的一些地方。它显示地图很好。但从昨天开始,它只显示网格,并没有显示地图,当我添加委托方法时,它会在mapviewdidfiailtoload有时。MKMap查看显示只有网格不显示地图视图
我使用下面的代码
// MapView的
myMapView=[[MKMapView alloc] initWithFrame:CGRectMake(0,gameNameLabel.frame.size.height, 320, 181)];
myMapView.mapType=MKMapTypeStandard;
myMapView.delegate=self;
LocationModel *loc=presentGame.location;
NSArray *cordinates=[loc.geoCordinates componentsSeparatedByString:@","];
CLLocationCoordinate2D zoomLocation;
zoomLocation.latitude = [[cordinates objectAtIndex:0] doubleValue];
zoomLocation.longitude= [[cordinates objectAtIndex:1] doubleValue];
MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 0.5*METERS_PER_MILE, 0.5*METERS_PER_MILE);
// 3
MKCoordinateRegion adjustedRegion = [myMapView regionThatFits:viewRegion];
// 4
[myMapView setRegion:adjustedRegion animated:YES]; [scroll addSubview:myMapView];
Place *pin = [[Place alloc] init];
pin.name = loc.gameLocation;
pin.latitude = [[cordinates objectAtIndex:0] doubleValue];
pin.longitude = [[cordinates objectAtIndex:1] doubleValue];
PlaceMark* Place1 = [[PlaceMark alloc] initWithPlace:pin];
Place1.tagg=1;
[myMapView addAnnotation:Place1];
//end of mapview
- (MKAnnotationView *)的MapView:(*的MKMapView)mapView1 viewForAnnotation:(ID)注释{
static NSString *identifier = @"PlaceMark";
if ([annotation isKindOfClass:[PlaceMark class]]) {
MKPinAnnotationView *annotationView = (MKPinAnnotationView *) [mapView1 dequeueReusableAnnotationViewWithIdentifier:identifier];
annotationView.tag=[mapView1.annotations count];
if (annotationView == nil) {
annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:identifier];
} else {
annotationView.annotation = annotation;
}
annotationView.enabled = YES;
annotationView.canShowCallout = YES;
return annotationView;
}
return nil;
}
METERS_PER_MILE定义为1609.344 和ih ave在.h文件中设置委托。
所有的事情是工作正常,但现在只显示网格,它显示引脚atleaset
你太接近地表了,在这样的分辨率下没有地球的图像=)至少这是我的情况的问题 – Ossir
不,我不这样做,因为它显示地图一些时间。请建议一些东西 – user100
检查你的网络连接 –