问题
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:
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.
来源:https://stackoverflow.com/questions/15669308/how-to-use-delegates-in-google-map-api-for-ios-6