質問

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
.

役に立ちましたか?

解決

iOS Google Maps SDK、GMSMARKER TAPイベント

を聴くことができません。

mapview_.delegate= self;

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top