简体   繁体   中英

google symbol is not showing on Mapkit

I'm using Mapkit in my code and everything works fine. but the google symbol which usually shows on google Map(Mapkit) is not showing any more. Can anyone suggest me what happen to my code any suggestion.

Thanks in advance...

-(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:
(id <MKAnnotation>)annotation {
    MKPinAnnotationView *pinView = nil; 
    if(annotation != mapView.userLocation) 
    {
        static NSString *defaultPinID = @"com.invasivecode.pin";
        pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
        if ( pinView == nil ) pinView = [[[MKPinAnnotationView alloc]
                                          initWithAnnotation:annotation reuseIdentifier:defaultPinID] autorelease];

        pinView.pinColor = MKPinAnnotationColorRed; 
        pinView.canShowCallout = YES;
        pinView.animatesDrop = YES;
    } 
    else {
        [mapView.userLocation setTitle:@"I am here"];
    }
    return pinView;
}




-(void)LoadLocationOfOffices {
    places = [[NSMutableArray alloc] init];
    Place *aPlace1 = [Place alloc];
    aPlace.title = @"xyz";
    aPlace.subtitle = @"xyz ";

    CLLocationCoordinate2D crd1;
    crd1.latitude = ;
    crd1.longitude = ;

    [aPlace1 addCoordinates:crd1];
    [places addObject:aPlace1];
    [aPlace1 release];
    aPlace1 = nil;

    /*
     Object having address of office 2
     */
    Place *aPlace2 = [Place alloc];
    aPlace2.title = @"xyz";
    aPlace2.subtitle = @"xyz ";
    CLLocationCoordinate2D crd2;
    crd2.latitude = ;
    crd2.longitude = ;
    [aPlace2 addCoordinates:crd2];
    [places addObject:aPlace2];
    [aPlace2 release];
    aPlace2 = nil;

}


-(void) initializeNavigationalBar {

    CLLocationCoordinate2D centreCarte;
    centreCarte.latitude = ;
    centreCarte.longitude = ;
    MKCoordinateSpan zoom;

    zoom.latitudeDelta = 2;
    zoom.longitudeDelta = zoom.latitudeDelta;

    MKCoordinateRegion region;
    region.center = centreCarte;
    region.span = zoom; 

    [mapView setRegion:region animated:TRUE];
    [mapView addAnnotations:places];
}

If you don't show the "Google logo", your app will be rejected. The default logo is shown in southwest position in the map.

Use this:

- (UIImageView*) googleLogo {

    UIImageView *imgView = nil;
    for (UIView *subview in self.subviews) {
        if ([subview isMemberOfClass:[UIImageView class]]) {
            imgView = (UIImageView*)subview;
            break;
        }
    }
    return imgView;
}

@end

to change the google logo position this is the snippet:

- (void) alignGoogleLogo:(UITextAlignment) alignment {

  UIImageView *logo = [self googleLogo];
  CGRect frame = logo.frame;
  float padding = 9;

  if (alignment == UITextAlignmentLeft) {

    frame.origin.x = padding;

  } else if (alignment == UITextAlignmentCenter) {

    frame.origin.x = (self.size.width / 2) - (frame.size.width / 2);

  } else if (alignment == UITextAlignmentRight) {

    frame.origin.x = self.size.width - frame.size.width - padding;
  }

  [logo setFrame:frame];

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM