0
我正在使用Google Maps iOS SDK作爲我正在使用的應用程序。我現在需要在應用程序返回到前臺或用戶返回到地圖視圖時重新映射用戶當前位置的地圖。我搜索並搜索了一些東西,然而,沒有任何工作。使用Swift將應用程序返回到前臺時的Recenter Google地圖
我已經嘗試將代碼放置在CoreLocation堆棧的「didUpdateLocations」處理程序中,但這不起作用。與此同時,viewWillAppear函數在應用程序返回到前臺時不會被調用,所以也不起作用。
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let camera = GMSCameraPosition.camera(withLatitude: (manager.location!.coordinate.latitude), longitude: (manager.location!.coordinate.longitude), zoom: 16.0)
self.mapView?.animate(to: camera)
}
任何幫助表示讚賞。