Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MKMapView mapTypes

Until recently I thought there are only three options that can be set to MKMapView mapType.

[mapView setMapType:MKMapTypeStandard];
[mapView setMapType:MKMapTypeHybrid];
[mapView setMapType:MKMapTypeSatellite];

But as mentioned in this link how could I load the Google map in terrain view in iphone, one can also get "Terrain type(not mentioned in docs)" by setting

[mapView setMapType:3];

Interesting thing is maximum zoom in allowed in Terrain mode is different from other native modes. Instead of 3 above I tried integers <3 but that does not work(MapView shows Standard type only). Does anyone know if there are more options to set as type of MKMapView?

Thanks in advance.

like image 267
alekhine Avatar asked Jan 05 '12 10:01

alekhine


People also ask

What is MKMapView?

The MKMapView class supports the ability to annotate the map with custom information. Because a map may have large numbers of annotations, map views differentiate between the annotation objects used to manage the annotation data and the view objects for presenting that data on the map.

What is Apple MapKit?

MapKit lets you bring the world's most detailed city experiences from Apple Maps to your apps and websites, all with a focus on privacy. And you can use the new Maps Server API to create more functional experiences across platforms.

What is MKCoordinateSpan in Swift?

MKCoordinateSpan is the width and height of the map view in degrees, namely the latitudeDelta and longitudeDelta.


1 Answers

I came across this problem too. I'd used [mapView setMapType:MKMapTypeSatellite]; in my init method and the map type wouldn't change.

What fixed it was moving that line to my viewDidLoad method:

- (void)viewDidLoad {
  [mapView setMapType:MKMapTypeSatellite];
}
like image 182
Ali Avatar answered Oct 06 '22 19:10

Ali