1
我有以下代碼,沒有錯誤,當我運行這個。長按工作正常,雙擊不工作。在添加雙擊手勢之前,我已經禁用了縮放。Xcode7 swift2 - 雙擊MKMapView不起作用
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
manager = CLLocationManager()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
manager.requestWhenInUseAuthorization()
manager.startUpdatingLocation()
routeMapView.zoomEnabled = false
routeMapView.showsPointsOfInterest = true
let doubleTapGesture = UITapGestureRecognizer(target: self, action: "routeMapDoubleTapSelector:")
doubleTapGesture.numberOfTapsRequired = 2
routeMapView.addGestureRecognizer(doubleTapGesture)
let ulpgr = UILongPressGestureRecognizer(target: self, action:"routeMapLongPressSelector:")
ulpgr.minimumPressDuration = 2.0
routeMapView.addGestureRecognizer(ulpgr)
}
任何幫助?
它現在有效。我在doubleTap選擇器方法中刪除了「if gestureRecognizer.state」條件。感謝您的幫助。 – sfbayman