1
面對使用xcode v7.2.1和ios模擬器v9.2的問題。 我面臨的問題是,當我運行應用程序時,地圖顯示爲空白。 網格線出現一秒鐘,然後它只是空白。我試過尋找解決方案,但沒有找到任何工作。ios 9模擬器中的mapView爲空白
import UIKit
import MapKit
class ViewController: UIViewController, MKMapViewDelegate {
@IBOutlet var map: MKMapView!
override func viewDidLoad() {
super.viewDidLoad()
//maps integration
let longitude : CLLocationDegrees = 17.486374
let latitude : CLLocationDegrees = 78.543345
let longDelta : CLLocationDegrees = 0.1
let latDelta : CLLocationDegrees = 0.1
let location : CLLocationCoordinate2D = CLLocationCoordinate2DMake(latitude, longitude)
let span : MKCoordinateSpan = MKCoordinateSpanMake(latDelta, longDelta)
let region : MKCoordinateRegion = MKCoordinateRegionMake(location, span)
map.setRegion(region, animated: true)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
提前感謝!
我認爲這可能會讓您的經緯度值產生混淆。現在,您經歷的經緯度將帶您到斯瓦爾巴羣島和揚馬延島(挪威北部不遠處的一些偏遠島嶼),但如果您更改經緯度,您就可以在印度得到海得拉巴。 – TylerTheCompiler
您的跨度太小。嘗試:0.15D爲兩個latDelta和0.26爲longDelta。如果它不起作用,請嘗試增加值。它會渲染。但隨着你現在提供的跨度,它變得非常大,看起來空白。我剛剛測試過這個。 – Brandon
@DrBeardface非常感謝。但即使它是偏遠島嶼,爲什麼它是空白的?是因爲他們沒有被映射? – baconSoda