Apple MapKit 3D flyover

谁说我不能喝 提交于 2019-12-02 17:20:13

You can now use the new iOS 9 MKMapTypeSatelliteFlyover type.

Found this in the MapKit Reference:

Reference Link

showsBuildings A Boolean indicating whether the map displays extruded building information.

Declaration SWIFT var showsBuildings: Bool OBJECTIVE-C @property(nonatomic) BOOL showsBuildings Discussion When this property is set to YES and the camera has a pitch angle greater than zero, the map extrudes buildings so that they extend above the map plane, creating a 3D effect. The mapType property must be set to MKMapTypeStandard for extruded buildings to be displayed. The default value of this property is YES.

Import Statement import MapKit

Availability Available in iOS 7.0 and later.

MKMapCameraClass:

pitch The viewing angle of the camera, measured in degrees.

Declaration SWIFT var pitch: CGFloat OBJECTIVE-C @property(nonatomic) CGFloat pitch Discussion A value of 0 results in a camera pointed straight down at the map. Angles greater than 0 result in a camera that is pitched toward the horizon by the specified number of degrees. If the map type is MKMapTypeSatellite or MKMapTypeHybrid, the pitch value is clamped to 0.

The value in this property may be clamped to a maximum value to maintain map readability. There is no fixed maximum value, though, because the actual maximum value is dependent on the current altitude of the camera.

Import Statement import MapKit

Availability Available in iOS 7.0 and later.

In order to achieve what you want, you have to play with the camera. You'll have to update the pitch, heading, and altitude if needed.

Have a look here, you'll find everything : MKMapCamera Class Reference

Update : Unfortunately, you can't pitch maps who are satellite or hybrid.

If the map type is MKMapTypeSatellite or MKMapTypeHybrid, the pitch value is clamped to 0.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!