1

I have a view that calls visibleMapRect twice on a MKMapView with the same value both times. The first time it loads as expected (the map changes the visibleMapRect, though that's expected). The second time I re-use the visibleMapRect I used the first time, and end up with a different origin. Is there something special I need to do? I would expect the same results with the same visibleMapRect.

livings124
  • 1,103
  • 1
  • 10
  • 23

1 Answers1

1

Setting the visibleMapRect is effectively the same thing as setting the region and the documentation for region says:

When setting this property, the map may adjust the new region value so that it fits the visible area of the map precisely. This is normal and is done to ensure that the value in this property always reflects the visible portion of the map. However, it does mean that if you get the value of this property right after setting it, the returned value may not match the value you set. (You can use the regionThatFits: method to determine the region that will actually be set by the map.)

So, if you set visibleMapRect with a given origin and then check the map views value for visibleMapRect, you can get a different origin.

This has nothing to do with setting the map rect twice, but from your brief description, this is my best guess. If this is not helpful, please elaborate a bit more.

Timothy Moose
  • 9,895
  • 3
  • 33
  • 44
  • The issue I'm seeing is I set the visibleMapRect and it changes the map view's visibleMapRect/region as expected, but the next time sometime down the row, before I change it the visibleMapRect/region of the map has changed (user interaction is disabled for the map). Then setting visibleMapRect to the value I initially used results in the map's visibleMapRect not being the same. – livings124 Apr 29 '14 at 15:41
  • I'm really having a hard time parsing your explanation. Maybe you could list the process step-by-step, writing our your API calls and the values. – Timothy Moose Apr 29 '14 at 17:00