1

I am getting below debug info, and map is not loading at all.

Trying to initialize GEOVectorTile (2047.2047.12 GEOTileSetStyle_VECTOR_ROADS, GEOTileSize_PX512, GEOTileScale_NODPI) with non-VMP4 data.
halfer
  • 19,824
  • 17
  • 99
  • 186
Sanoj Kashyap
  • 5,020
  • 4
  • 49
  • 75

1 Answers1

1

below is the Code to Zoom to your Current Location.

 mpView.showsUserLocation = YES;

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

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

Here i have Created one Button, on click on button i can easily navigate to current location.

-(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];
}

Here is my method for 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;
}

//You can customise as per your requirement.

Mehul
  • 3,033
  • 23
  • 37