Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

In one of my iPad apps, I use MKMapView to show regions and I have a weird issue. I use setRegion: animated: method to set a particular region from a noOf points. When I zoom from that particular point in the map, the map shows grids with no image of the place/location. Does anyone has the same issue before? Can someone provide a solution for how to handle this zoom level issue?

Attaching the image for more reference

Initially, I call the setRegion: method of mapview with a 2d co-ordinate and its span as 0.0014f for both latitude and longitude delta values. So I get the following image.

enter image description here

After that if I try to zoom in the mapview again, it goes to a situation like the following

enter image description here

My concern is, whether there is a way to restrict the zoom in to avoid the black layer display/how can I restrict the zoom in once mapview reaches its best possible zoomed cells.

share|improve this question
    
You need to explain more clearly. Firstly, where are your pints. Maybe there is no data there. Maybe you are zoomed in too close. Do you mean zoom from those coordinates or zoom to. –  Craig May 6 '13 at 22:24

2 Answers 2

when you zoom in CLOSE the mapview wants to show the most detailed tiles and nothin else. For certain areas (gov, military or places where there is nothing) there are no tiles and it runs into that!

the problem is that you dont know beforehand where there are or aren't any tiles available.

what I could imagine: when you zoom. regionWillChange: is called and then willStartLoading: should be called and then mapViewDidFailLoadingMap:withError in the case of no tiles

(im guessing here)

share|improve this answer
    
I agree. But in the Apple Maps implementation, they are giving a bouncing effect for such cases, they won't allow us to zoom in that close for once it reaches these condition. Is there a way to achieve the same effect? –  Sagar S. Kadookkunnan May 7 '13 at 15:58
    
not that I know, they don't use MKMapView... –  Daij-Djan May 7 '13 at 16:03
    
although... mapViewDidFailLoadingMap:withError –  Daij-Djan May 7 '13 at 16:04
//fix for ios6
if (region.span.latitudeDelta < .0005f)
    region.span.latitudeDelta = .0005f;
if (!region.span.longitudeDelta < .0005f)
    region.span.longitudeDelta = .0005f;

Make sure your region span for lat/lon isn't set too low and it will clear up.

Edit for clarity: In iOS6, setting a span delta too low (less than .0005 for instance) will cause it to literally set the map view to that region, regardless of if it has a tile set of images for that level of detail. IE: if you zoom in too far, there are no map tiles to represent the region. In iOS5 it would handle trying to zoom in too far and clip the region without causing an issue.

To fix this, you can set the region span lat and lon delta to a minimum value so the map still presents itself. Any time when setting the map region, or causing it to change, check for a minimum value.

share|improve this answer
    
No context or explaination. –  Pedr Jul 17 '13 at 17:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.