Apple MapKit 3D天桥 [英] Apple MapKit 3D flyover
问题描述
是否有任何公共iOS 8 API可用于实现3D天桥或至少3D视图,如下面的Apple Maps App屏幕截图所示?
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?
更新
根据以下建议,我完成了以下代码:
After below suggestions I've done following code:
import UIKit
import MapKit
class ViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
mapView.showsBuildings = true
let eiffelTowerCoordinates = CLLocationCoordinate2DMake(48.85815,2.29452)
mapView.region = MKCoordinateRegionMakeWithDistance(eiffelTowerCoordinates, 1000,100)
mapView.mapType = MKMapType.Standard
// 3D Camera
let mapCamera = MKMapCamera()
mapCamera.centerCoordinate = eiffelTowerCoordinates
mapCamera.pitch = 45
mapCamera.altitude = 500
mapCamera.heading = 45
// Set MKmapView camera property
self.mapView.camera = mapCamera
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
现在我的应用程序看起来与Apple Maps App类似,但遗憾的是不一样。
Now my App looks similar to Apple Maps App but unfortunately not identical.
有人知道如何将所有纹理添加到建筑物中吗?
更新2
选中Google Maps iOS SDK。
完全相同的故事。
除了 kGMSTypeNormal
之外的任何模式都没有3D建筑物这意味着没有可用的纹理建筑物。
Google Maps iOS SDK checked.
Absolutely same story.
No 3D buildings in any mode except kGMSTypeNormal
That means no textured buildings available.
以下代码:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let camera = GMSCameraPosition.cameraWithLatitude(48.85815, longitude: 2.29452, zoom: 50, bearing:30, viewingAngle:40)
let mapView = GMSMapView.mapWithFrame(CGRectZero, camera: camera)
mapView.mapType = kGMSTypeNormal
mapView.buildingsEnabled = true
self.view = mapView
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
呈现以下屏幕截图:
推荐答案
您现在可以使用新的iOS 9 MKMapTypeSatelliteFlyover类型。
You can now use the new iOS 9 MKMapTypeSatelliteFlyover type.
这篇关于Apple MapKit 3D天桥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!