[英]iOS Swift MapKit will not reload
我的情節提要板上有一個MapKit視圖-設置為隱藏。 使用以下代碼,我可以使用button(1)單擊取消隱藏它,並且可以完美加載。 再次單擊按鈕(2)將隱藏地圖。 問題是重新加載地圖。 如何使用button(1)重新加載地圖。 目前,該地圖將不再顯示。
這是加載地圖的完整代碼:
@IBAction func ButtonOne(sender: UIButton) {
self.myMap()
}//End Button(1)
@IBAction func ButtonTwo(sender: UIButton) {
self.mapView.hidden = true
}//End Button(2)
func myMap() {
let userLocation = self.mapView.userLocation
let region = MKCoordinateRegionMakeWithDistance(
userLocation.location.coordinate, 2000, 2000)
self.mapView.hidden = false
self.mapView.frame = CGRect(x: 0, y: 0, width: screenSize.width, height: screenSize.height * 0.75)
self.mapView.setRegion(region, animated: true)
}
我只是在斷開連接/隱藏時使用“ exit(1)”,然后在通話結束時使用map。 BTT用戶仍然無法使用仍然可以使用該應用程序。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.