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)
}
任何帮助表示赞赏。