continuous/repeating MKMapView
I'm looking for a MKMapView which can be scrolled continuously in any direction and repeats itself. It has to be a MKMapView/subclass and not a custom Map-Framework like route-me.
开发者_如何学运维How to implement that on top of a MKMapview?
I do not know if there's framework already for this, but here's an idea.
Use infinite scroll view sample from wwdc idea and apply it to mapview. So for example, use two mapviews side by side (for infinite scroll along X axis)
Usually one mapview will be shown, but when the dragging goes past the edges of the left/right, then you could slide one mapview out and slide in another mapview.
Your viewcontroller will need to add annotations to both mapviews of course, and if you want to support any direction, that can possibly mean you need 4 map views to cover corner case.
You can probably treat mapview as scrollview when doing this infinite scroll trick, as described in wwdc 2011 scrollview session.
To keep both mapviews in sync, you will need to pass messages between two, for example zoom level. Not sure if mapview has all things you need to observe these things, but do take a look. You could possibly use KVO to observe the internal variable without violating Apple private API check.
Good luck and let me know how it goes.
精彩评论