Apple MapKit 3D flyover

后端 未结 4 816
滥情空心
滥情空心 2021-01-31 12:33

Is there any public iOS 8 API available to implement 3D flyover or at least 3D view as shown on Apple Maps App screenshot below?

相关标签:
4条回答
  • 2021-01-31 12:38

    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.

    0 讨论(0)
  • 2021-01-31 12:39

    mapType property of MKMapView enum can be used to change the map type or region.

    You can use hybridFlyover property to show satellite image along with flyover data where it is available.

    Usage:

    objMapView.mapType = .hybridFlyover
    

    Here, objMapView is an instance of MKMapView class.

    0 讨论(0)
  • 2021-01-31 12:56

    You can now use the new iOS 9 MKMapTypeSatelliteFlyover type.

    Test App Screenshot

    0 讨论(0)
  • 2021-01-31 13:00

    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.

    0 讨论(0)
提交回复
热议问题