2013-10-03 12 views
5

Sono bloccato con GoogleMaps SDK per iOS ...
Desidero aggiungere alcune funzionalità quando tocco un GMSMarker sulla mia Google Map, ma non lo fa lavorare C'è qualcosa che non va?SDK iOS di Google Maps, Impossibile ascoltare GMSMarker tocca l'evento

FirstController.h

#import <UIKit/UIKit.h> 
#import <GoogleMaps/GoogleMaps.h> 
#import <CoreLocation/CoreLocation.h> 
#import "sqlite3.h" 

@interface FirstViewController : UIViewController <CLLocationManagerDelegate, 
                GMSMapViewDelegate> 
{ 
    sqlite3 *db; 
} 

FirstController.m

[...] 

-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation 
{ 
    camera = [GMSCameraPosition cameraWithLatitude:newLocation.coordinate.latitude longitude:newLocation.coordinate.longitude zoom:(12)]; 
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera]; 
    mapView_.myLocationEnabled = YES; 

    for(GMSMarker *currentMarker in _locationMarkers) 
    { 
     currentMarker.map = mapView_; 
    } 

    self.view = mapView_; 
} 


-(BOOL) mapView:(GMSMapView *) mapView didTapMarker:(GMSMarker *)marker 
{ 
    NSLog(@"try"); 
    return YES; 
} 

risposta

18

Penso che potrebbe essere necessario questo, dopo aver creato la mappa:

mapView_.delegate = self; 
+0

lavorato, grazie ! Ho accidentalmente messo quel codice nel metodo sbagliato! – Michele

Problemi correlati