[英]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.