iOSのためにGoogleマップ上のピンを停止する方法
-
21-12-2019 - |
質問
GoogleマップSDKをiOSに使用しています。ユーザーがマップ内の長い押下をしたときにPINを落とそうとしています。以下のコードは、私が私のController.mと.hファイルに持っているものです。タップ/ロングプレス(コード内で変更します)を押すと、コンソールに記録されているものは何も入手していません。ただし、マップはロードされています。任意のアドバイス?
マップイベントセクションからコードを使用しています。 https://developers.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
.
controller.hファイル:
#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
@interface MapWithinPinViewController : UIViewController<GMSMapViewDelegate>
@end
. 解決
mapview_.delegate= self;
所属していません StackOverflow