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',如果沒有連接它。 –
啊是的,我錯過了,現在的作品,非常感謝 –