0
我試圖以編程方式創建映射,但是一旦我運行該應用程序,我就會得到一個黑屏。無法以編程方式在Xcode中創建映射(Big Nerd Ranch IOS編程:第6章p97)
重97頁的大牧場書呆子iOS的編程第5版,第6章「創建視圖編程」
我進入了MapViewController.swift
// MapViewController.swift
import UIKit
import MapKit
// Define a UIViewController subclass named MapViewController
class MapViewController: UIViewController {
var mapView: MKMapView!
override func loadView() {
// create a map view
mapView = MKMapView()
// set it as *the* view of this view controller
view = mapView
}
override func viewDidLoad() {
// Always call the super implementation of viewDidLoad
super.viewDidLoad()
print("MapViewController loaded its view.")
}
}
下面的代碼當我運行應用程序我得到一個黑色的屏幕應該是地圖。出了什麼問題?
謝謝!