1
全屏这是当前的代码,使编辑建议后,就不再显示在地图悉尼澳大利亚谷歌地图API中SWIFT3
类LocateVC上的标记:的UIViewController {
@IBOutlet weak var mapView: GMSMapView!
override func viewDidLoad() {
super.viewDidLoad()
//override func loadView() {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
let camera = GMSCameraPosition.camera(withLatitude: -33.86 , longitude: 151.20, zoom: 6.0)
let mapView = GMSMapView.map(withFrame: self.mapView.bounds, camera: camera)
self.mapView = mapView
// Creates a marker in the center of the map.
let marker = GMSMarker()
marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20)
marker.title = "Sydney"
marker.snippet = "Australia"
marker.map = mapView
}
}
输出
屏幕
好的,做到了。这现在给了我一个致命的错误:意外地发现零时,加载地图时解包可选值 –
@JadeReynolds检查你的'mapView'插座是否正确连接到'LocateVC',如果没有连接它。 –
啊是的,我错过了,现在的作品,非常感谢 –