2017-04-11 59 views
0

在Android上点击标记两个按钮显示在屏幕底部的方向和打开谷歌地图。但是,iOS上的点击标记只显示信息窗口。谷歌地图的iOS - 点击标记显示默认的谷歌方向按钮

我需要显示信息窗口和方向和谷歌地图按钮上的敲击标记,就像在Android中一样。

我添加标记代码:

GMSMarker *marker = [[GMSMarker alloc] init]; 
marker.position = [(CLLocation*)dict[@"position"] coordinate]; 
marker.icon = [GMSMarker markerImageWithColor:[UIColor ubnBlue]]; 
marker.title = dict[@"title"]; 
marker.snippet = dict[@"snippet"]; 
marker.appearAnimation = kGMSMarkerAnimationPop; 
marker.tappable = YES; 
marker.map = mapView_; 
+0

我会帮你 – user3182143

回答

0

首先设置GMSMapViewDelegate方法

- (BOOL) mapView: (GMSMapView *)mapView didTapMarker:(GMSMarker *)marker 
{ 
    [mapView setSelectedMarker:marker]; 
    return YES; 
} 

- (UIView *GMS_NULLABLE_PTR)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker 
{ 
    NSLog(@"The amrker snippet is - %@",marker.snippet); 
    if([marker.snippet isEqualToString:@"your string"]) //check here 
    { 
     ....//Do the stuff here 
    } 
} 
0

首先,你需要设置然后yourController.h委托方法文件,你可以用它处理方法

- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker { 

return Yes; 

} 

要显示您需要调用的信息窗口marker.title = @"title";

0

GMSMarker具有属性iconView。您可以将UIView分配给iconView。

实施GMSMapViewDelegate委托方法

(BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker { 

} 

现在,因为你需要,你可以改变你的看法。