Callout View

Of all the built-in UI controls on iOS, the mysterious "UICalloutView" is surely one of the most interesting.

You can find it when tapping a pin in the Maps app, or when using an embedded MapView in your own apps. But because it's a private class, you can't use it in custom map views and other surfaces.

Which is a shame, because it's an extremely complex beast to try and reproduce: The size of the callout and position of its arrow is dynamically calculated, and sometimes it will even "scoot over" the map first before appearing. Tricky stuff.

Because of this complexity, I haven't yet seen a 3rd party control that matches Apple's exactly. So I've set out to make one! Here's mine so far (on the top) compared to the built-in control (on the bottom).

So far so good I think; what you can't see is that even the complex "bubble" appearance animation is exactly the same; I inspected the animation keyframes of the system control while it was appearing in slow-motion.

Once it's finished, I'll open-source it on Github. I hope you'll find it useful for your projects!

View all tags
Posted on Aug 12, 2012

More by Nick Farina

View profile