MKMapView: how can I reproduce the "bounce-zoom" seen in Apple's Find My iPhone / Friends apps?

Background

MKMapView comes with several methods that allow you to set a visible rect map (or region, coordinate range, etc.). These methods have an animated parameter, and when set to true, a linear animation of approximately 0.3 seconds is used to revitalize the change.

Question

While this is good, I would like to play back the animation that Apple used in the Find Friends and Find My iPhone apps when I clicked on the map. If you try this on your own, you will notice a much faster animation (approximately 0.15 seconds) with a non-linear curve. For now, let me call it "fail-scaling."

I would like to reproduce both a non-linear animation curve and a custom animation duration. Wrapping map updates in UIView animateWithSpring ... the method does not seem to work (maybe I'm wrong). It is very well known that Apple may be able to do things that are not publicly available in the MKMapView API, however, the common Apple App Store applications usually seem to adhere to their recommendations on the public API.

Is it possible? If so - how? Just changing the duration of the animation is not what I need. I would also like to control the animation curve.

Code example

See here for a playground trying to do this. Note that MKMapView seems to take into account the duration of the animation, but not elasticity, such as Find My iPhone / Find my Friends.

+5
source share
1 answer

I think you are looking for AnimateWithDuration and use the UIViewAnimationOptionCurveEaseInOut option. I did something similar in the application I created, but with buttons. I needed to combine the animation together. Do it 100% of the estimated size, then 80%, then back 100%

+2
source

All Articles