How to use delegates in Google map API for IOS 6 [

2020-07-28 11:42发布

In my iphone app I am using google map SDK for showing nearby restaurants.I am able to show the places. I have some doubts..

1. How can I find out the center coordinates of the map ??

2. How to revert back to current position ?

3.How to find out the map is moved- ie center coordinates changed(just like regionChanged delegate in MKMapView)

1条回答
时光不老,我们不散
2楼-- · 2020-07-28 12:27

This should probably be three separate questions, however:

1.

GMSMapView* _mapView = ...;
CLLocationCoordinate2D centre = _mapView.camera.target;

2.

GMSMapView* _mapView = ...;
CLLocationCoordinate2D currentPosition = _mapView.myLocation.coordinate;
CGFloat currentZoom = _mapView.camera.zoom;
GMSCameraPosition* camera = 
    [GMSCameraPosition cameraWithTarget: currentPosition zoom: currentZoom];
_mapView.camera = camera;

3.

Use the [mapView:didChangeCameraPosition:] delegate method.

查看更多
登录 后发表回答