Question

I just ran into a weird bug. If I try setting 3D perspective on my MKMapView to YES, it is still set to NO.

Here is a sample code that retrieves… NO

[self.mapView setPitchEnabled:YES];
NSLog(@"Is Pitch enabled ? - Answer:  %hhd", [self.mapView isPitchEnabled]);

Output:

Is Pitch enabled ? - Answer:0

Was it helpful?

Solution

Apple Doc:

When this property is set to YES and a valid camera is associated with the map, the camera’s pitch angle is used to tilt the plane of the map.

I don't see you setting any camera.

A sample camera implementation:

MKMapCamera *newCamera = [[mapView camera] copy];
[newCamera setPitch:45.0];
[newCamera setHeading:90.0];
[newCamera setAltitude:500.0];
[mapView setCamera:newCamera animated:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top