We’re working on the next major update to our app at Spectafy and as part of that work, we plus–ing a lot of the visual effects.
One of the things we’ve discovered is that there are some scenarios where slowing down the rate we zoom in or out on the map is helpful in drawing the user’s attention to the new information exposed at the new zoom level.
Of course, there’s one problem …
Google Maps on iOS doesn’t expose a way to control the rate of zoom.
The good news is …
Google Maps uses standard iOS animation features to perform the zoom animation. As a result, we can use Core Animation classes to override the rate of zoom.
Here’s the code…
CATransaction.Begin(); CATransiaction.AnimationDuration = 3; _mapView.Animate(CameraUpdate.SetTarget(new CLLocationCoordinate2D(lat, lng), zoomLevel)); CATransaction.Commit();
In the above code, we simply place the standard Google Maps call that triggers the zoom animation [ _mapView.Animate( … ) ] within a CATransaction, and set the AnimationDuration to 3 seconds within that transaction. That easily we’ve slowed down the animation so that the zoom effect takes 3 seconds.
Try it out … you’ll find that subtle changes in the zoom speed can have a dramatic effect on user experience.
[…] Use Xamarin.iOS to Control Google Maps Zoom Speed for a More Dramatic Look (Jim Wilson) […]