我有一个奇怪的问题,我无法使这种方法做任何事情!我已经添加了地图视图委托,并在顶部AND头文件中对委托进行了删除。我打算在用户触摸通过点击Google Maps标记产生的气泡时得到响应

这是我所拥有的

#import "ViewController.h"
#import "Location.h"

@interface ViewController () <GMSMapViewDelegate>

@property(nonatomic)NSMutableArray* storedLocations;
@property(nonatomic)NSMutableArray* myPlaces;

@end

@implementation ViewController {

GMSMapView *mapView;

}

- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker     *)marker{

 UIAlertView* new = [[UIAlertView alloc] initWithTitle:@"Nice!" message:@"Good stuff" delegate:self cancelButtonTitle:@"Well Done!" otherButtonTitles:nil];
[new show];


}

- (void)viewDidLoad {
    [super viewDidLoad];

    // Create Map View on scene with camera
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:0
                                                        longitude:0
                                                             zoom:0];
    mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    mapView.myLocationEnabled = YES;
    self.view = mapView;
    mapView.delegate = self;


正如目前所提到的,触摸气泡无济于事

最佳答案

如果您想知道自己的标记是否被点击,请致电

(BOOL) mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *) marker方法

您使用的方法,只有在点击标记的信息窗口时才会调用。

关于ios - Google Maps iOS SDK didTapInfoWindowOfMarker无法正常工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29415186/

10-14 13:59
查看更多