I would like to be able to change the filling of the GMSMapView without changing the location of the map. Currently, the Google Maps iOS SDK is changing the location of the map, so that the same point is in the center after adding the add-on. This is different from how the Android SDK works, which just leaves the card as it is.
I found a small workaround for this, but it does not work sequentially. I can calculate what should be for the new center location, and update the map camera when I change the gasket as follows ...
UIEdgeInsets oldPadding = self.mapCtrl.map.padding; UIEdgeInsets newPadding = UIEdgeInsetsMake(top, left, bottom, right); float deltaX = ((newPadding.right - newPadding.left)/2 - (oldPadding.right-oldPadding.left)/2); float deltaY = ((newPadding.top - newPadding.bottom)/2 - (oldPadding.top-oldPadding.bottom)/2); GMSCameraUpdate *updatedCamera = [GMSCameraUpdate scrollByX:deltaX Y:deltaY]; [self.mapCtrl.map setPadding:newPadding]; [self.mapCtrl.map moveCamera:updatedCamera];
But I would say that it only works at 50%. The remaining 50% of the card is moved to a new place of filling, and then back to where I want.
I see two possible solutions for this: A) change the gasket in another way so that it does not move the card, or B) figure out a way to make the above code work somehow to pause or group card movements so that both calls go through at once. But I canβt figure out how to do either of these two things.
source share