1
我得到以下調試信息,與地圖沒有加載在所有。地圖不加載,只顯示平鋪視圖?
Trying to initialize GEOVectorTile (2047.2047.12 GEOTileSetStyle_VECTOR_ROADS, GEOTileSize_PX512, GEOTileScale_NODPI) with non-VMP4 data.
我得到以下調試信息,與地圖沒有加載在所有。地圖不加載,只顯示平鋪視圖?
Trying to initialize GEOVectorTile (2047.2047.12 GEOTileSetStyle_VECTOR_ROADS, GEOTileSize_PX512, GEOTileScale_NODPI) with non-VMP4 data.
下面是縮放到您當前位置的代碼。
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;
}
方法//你可以定製按您的要求。
檢查您的網絡連接,重新啓動模擬器並再次嘗試,我的朋友 – Mehul
謝謝你的好友,是啊互聯網下跌。 – Sandy
是的,沒問題我的朋友。請享用。 – Mehul