2015-10-19 73 views
1

我得到以下调试信息,与地图没有加载在所有。地图不加载,只显示平铺视图?

Trying to initialize GEOVectorTile (2047.2047.12 GEOTileSetStyle_VECTOR_ROADS, GEOTileSize_PX512, GEOTileScale_NODPI) with non-VMP4 data. 
+1

检查您的网络连接,重新启动模拟器并再次尝试,我的朋友 – Mehul

+0

谢谢你的好友,是啊互联网下跌。 – Sandy

+0

是的,没问题我的朋友。请享用。 – Mehul

回答

1

下面是缩放到您当前位置的代码。

mpView.showsUserLocation = YES; 

[mpView setCenterCoordinate:mpView.userLocation.location.coordinate animated:YES]; 

[mpView showAnnotations:mpView.annotations animated:YES]; 

这里我已经创建了一个按钮,在点击按钮,我可以轻松地浏览到当前位置。

-(void)btnCurrentlocationClicked:(id)sender 
{ 
    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(ApplicationDelegate.locationManager.location.coordinate, 250, 250); 
    [mpView setRegion:region animated:YES]; 

    [mpView setCenterCoordinate:mpView.userLocation.location.coordinate animated:YES]; 

    // [mpView selectAnnotation:mapPin animated:YES]; 
    [mpView showAnnotations:mpView.annotations animated:YES]; 
} 

这里是我的VierForAnnotation

- (MKAnnotationView *)mapView:(MKMapView *)mapview viewForAnnotation:(id <MKAnnotation>)annotation 
{ 
    NSLog(@"viewForAnnotation"); 

    if ([annotation isKindOfClass:[MKUserLocation class]]) { 
     NSLog(@"Is the user %f, %f", [annotation coordinate].latitude, [annotation coordinate].longitude); 
//  MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(ApplicationDelegate.locationManager.location.coordinate, 250, 250); 
//  [mpView setRegion:region animated:YES]; 

     return nil; 
    } 


    static NSString* AnnotationIdentifier = @"AnnotationIdentifier"; 
    MKAnnotationView *annotationView = [mpView dequeueReusableAnnotationViewWithIdentifier:AnnotationIdentifier]; 

    NSString *strAnnotationSubtitle = [(MKPointAnnotation *)annotation subtitle]; 

    if (annotationView == nil) 
    { 
     annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier: AnnotationIdentifier] ; 
    } 
    else 
    { 
     annotationView.annotation = annotation; 
    } 
    annotationView.draggable=YES; 
    annotationView.canShowCallout = YES; 

    if([strAnnotationSubtitle isEqualToString:@"Pickup"]) 
    { 
     annotationView.image = [UIImage imageNamed:@"ic_pin_pickup"]; 
    } 
    else if ([strAnnotationSubtitle isEqualToString:@"Drop"]) 
    { 
     annotationView.image = [UIImage imageNamed:@"ic_pin_drop"]; 
    } 
    return annotationView; 
} 

方法//你可以定制按您的要求。