They both specify a map center and how big the box is.
So why use both?
Some function in MKMapview
use one and some use the other
(MKCoordinateRegion)regionThatFits:(MKCoordinateRegion)region
(MKMapRect)mapRectThatFits:(MKMapRect)mapRect
edgePadding:(UIEdgeInsets)insets
What's their difference?
More importantly, which one we should use to set the region we see?
There is no regionThatFits:edgePadding:
by the way.
A MKCoordinateRegion
is defined using degrees coordinate of type CLLocationCoordinate2D
which represents the latitude and longitude of a point on the surface of the globe.
MKMapRect
represents an actual flat rectangle defined with view coordinate (x, y) on your map view.
You can use functions to do conversions for you like MKCoordinateRegionForMapRect
See http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MapKitFunctionsReference/Reference/reference.html
And to answer your final question, you would use MKCoordinateRegion
which will define what region of the globe's surface you want to see and by definition it will set your zoom level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With