How can I limit the map area to only one country in the latest iOS6?

I am making an application for iOS 6 using mapkit. I want to limit the borders of the map only to a specific region / country. Is there any way to do this?

The problem has already been discussed here: how to limit the map area to only one country in iOS? with the only difference being a possible solution for ios 5 .

+4
source share
1 answer

You need to do CLLocationCorrdinate2D , then use this to create a region, and then set the map view to that region. Here is an example map set for ireland:

 CLLocationCoordinate2D ireland = CLLocationCoordinate2DMake(53.317749,-7.959643); [self.mapView setRegion: MKCoordinateRegionMakeWithDistance(ireland, 500000, 30000)]; [self.mapView setMapType: MKMapTypeStandard]; 

it will look something like this, depending on what you are testing: enter image description here the last two numbers RegionMakeWithDistance is the lat / long range in meters. The CLL point you select is the center point of the map. If you want to limit only this region, you want to rotate the scroll and zoom to display the map.

+2
source

All Articles