我坚持使用适用于 iOS 的 GoogleMaps SDK...
当我点击 Google 地图上的 GMSMarker 时,我想添加一些功能,但它不起作用。有什么不对?
第一控制器.h
#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
#import <CoreLocation/CoreLocation.h>
#import "sqlite3.h"
@interface FirstViewController : UIViewController <CLLocationManagerDelegate,
GMSMapViewDelegate>
{
sqlite3 *db;
}
第一控制器.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;
}