我想在移动 map 时执行一个操作,我尝试了此功能,但它不起作用:
func mapView(mapView: MKMapView, regionWillChangeAnimated animated: Bool) {
let alert = UIAlertView()
alert.title = "Hey"
alert.message = "Map Move"
alert.addButtonWithTitle("Working!!")
alert.show()
}
最佳答案
你设置了mapView.delegate吗?如果不是这样,则不会调用 regionWillChangeAnimated
方法。
示例。
override func viewDidLoad() {
super.viewDidLoad()
mapView.delegate = self
}
引用。我的 MKMapView 示例代码 https://github.com/koogawa/MKMapViewSample
关于ios - 本地图移动时执行操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33014861/