Xcode7 swift2 - 双击MKMapView无法正常工作

时间:2015-07-20 03:35:14

标签: ios xcode swift

运行此代码时,我有以下代码并且没有错误。长按工作正常,双击不起作用。我在添加双击手势之前禁用了缩放。

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)


}

任何帮助?

1 个答案:

答案 0 :(得分:1)

我尝试了你的代码,似乎工作正常。 "双击"打印出来。这是测试代码。

var files = NSMutableArray()
...
for (var i = 0; i < files.count; i++) {
    var f = files[i] as [String: AnyObject]
    f["selected"] = true
}