2013-10-03 13 views
5

Ich bin fest mit GoogleMaps SDK für iOS ...
Ich möchte einige Funktionen hinzufügen, wenn ich auf einem GMSMarker auf meiner Google Map tippen, aber es tut nicht arbeite nicht. Ist etwas nicht in Ordnung?iOS Google Maps SDK, kann nicht auf GMSMarker tippen Ereignis

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

Antwort

18

Ich denke, man könnte dies benötigen, nachdem Sie die Karte zu erstellen:

mapView_.delegate = self; 
+0

gearbeitet, dank ! Ich habe diesen Code versehentlich in die falsche Methode gesetzt! – Michele

Verwandte Themen