문제 설명
MKMapView가 약 180도 스크롤되지 않습니다. (MKMapView does not scroll around 180 degrees)
I have an MKMapView with the center set to ‑42, 179.5 degrees and scrolling enabled. I can scroll so the center is at locations less than 180 degrees, but if I try to scroll East past the meridian, scrolling is blocked‑‑I have to scroll all the way around the globe. This is, to put it mildly, inconvenient for people in, say, New Zealand.
How can I enable scrolling across the meridian in MKMapView?
참조 솔루션
방법 1:
There is no switch to enable scrolling across the datum limit. (longitude ‑180/180)
You can detect that yourself:
in regionDidChangedAnimated
, detect the coordinates of the right border, if they are near ‑180 or 180, show an arrow button (or try to intercept scrolling gesture) and call setRegion
or setCenter
with ,modified values such that the new region does not conatin the datum limit any more.
방법 2:
According to posts on the Apple Developer forums, this is a known, reported bug in iOS. Apple's Maps app had the same problem under iOS 5, but not under iOS 6, although the problem persists there for MKMapView.
Presumably this will start to work when the underlying bug is fixed. Meanwhile, if anyone has a work‑around, I'd be interested.
방법 3:
This issue will be fixed in iOS 7. The map view can now span the 180th meridian.