mapView didTapInfoWindowOfMarker方法不起作用? Google Maps iOS SDK [英] mapView didTapInfoWindowOfMarker method does not work? Google Maps iOS SDK
本文介绍了mapView didTapInfoWindowOfMarker方法不起作用? Google Maps iOS SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
还有其他人遇到这种情况吗?我正在使用最新的iOS版Google Maps SDK.这是我在didTapInfoWindowOfMarker方法中所拥有的:
Anyone else experiencing this? I'm using the latest Google Maps SDK for iOS. This is what I have in the didTapInfoWindowOfMarker method :
- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(id<GMSMarker>)marker {
NSLog(@"yes");
}
我的输出没有任何响应.
Not getting any response in my output.
推荐答案
听起来像没有为GMSMapView对象添加委托和协议,
Sounds like you didn't add delegate and protocol for your GMSMapView object, something like:
mapView_.delegate = self;
在loadView方法中.
in loadView method.
因此,完整的- (void)loadView
和委托方法应为:
So, the full - (void)loadView
and delegate method should be:
@interface ViewController () <GMSMapViewDelegate> // Add this if you haven't
{
id<GMSMarker> myMarker;
}
- (void)loadView {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.8683
longitude:151.2086
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
mapView_.delegate = self; // This sets the delegate for map view
self.view = mapView_;
}
- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(id<GMSMarker>)marker {
NSLog(@"yes"); // And now this should work.
}
这篇关于mapView didTapInfoWindowOfMarker方法不起作用? Google Maps iOS SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文