UI TableView中的Google Maps

时间:2017-02-27 13:18:40

标签: ios google-maps google-maps-markers marker

您好我是iOS中的Google地图新手。

我可以知道如何在任何位置显示标记吗?这意味着当我点击地图上的某个位置时,它应显示标记。

先谢谢。

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:151.20
                                                             zoom:6];
GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView.myLocationEnabled = YES;
self.view = mapView;

// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView;

[mapView setSelectedMarker:marker];

1 个答案:

答案 0 :(得分:0)

请您使用mapview的委托方法 喜欢:

- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(id)marker {     的NSLog(@ “是”); // 做一点事 }

并检查表视图的userinteractionenable。