Comment goupiller sur une carte Google pour iOS?
-
21-12-2019 - |
Question
J'utilise le SDK Google Maps pour iOS.J'essaie de laisser tomber un code PIN lorsque l'utilisateur appuie une longue pression sur la carte.Le code ci-dessous est ce que j'ai dans mon contrôleur.m et .h fichier.Lorsque je touche / longue pression (je le change dans le code), je ne reçois rien de connecté à la console.La carte, cependant, est en cours de chargement.Tout conseil?
J'utilise le code de la section des événements de cartes sous la documentation: https://développeurs.google.com/maps/documentation/ios/map
#import "MapWithinPinViewController.h"
#import <GoogleMaps/GoogleMaps.h>
#import <UIKit/UIKit.h>
@interface MapWithinPinViewController ()
@end
@implementation MapWithinPinViewController {
GMSMapView *mapView_;
}
- (void)viewDidLoad
{
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86 longitude:151.20 zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
}
- (void)mapView:(GMSMapView *)mapView didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate {
NSLog(@"You tapped at %f,%f", coordinate.latitude, coordinate.longitude);
}
@end
contrôleur.h Fichier:
#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface MapWithinPinViewController : UIViewController<GMSMapViewDelegate>
@end
La solution
Je viens de le comprendre en regardant iOS Google Maps SDK, impossible d'écouter GMSmarker Tap Event
mapview_.delegate= auto;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow