UISwipeGestureRecognizer无法向右滑动

时间:2015-06-30 02:27:13

标签: ios uiswipegesturerecognizer

我正在开发一个在Swift中编程的iOS应用程序,由于某种原因,我的应用程序无法识别/处理滑动右手势。这是我的代码:

self.feedTableViewCell.productPreview.userInteractionEnabled = true
var swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("respondToSwipeGesture:"))
swipeLeft.direction = UISwipeGestureRecognizerDirection.Left
self.feedTableViewCell.productPreview.addGestureRecognizer(swipeLeft)

var swipeRight = UISwipeGestureRecognizer(target: self, action: Selector("respondToSwipeGesture:"))
swipeRight.direction = UISwipeGestureRecognizerDirection.Right
self.feedTableViewCell.productPreview.addGestureRecognizer(swipeRight)

这是我的经纪人:

func respondToSwipeGesture(swipeGesture: UISwipeGestureRecognizer) {
    switch swipeGesture.direction {
    case UISwipeGestureRecognizerDirection.Left:
        println("swipe left")
    case UISwipeGestureRecognizerDirection.Right:
        println("swipe right")
    default:
        println("Unknown gesture")
        break
    }

    self.feedTableViewCell.pageControl.currentPage = self.currentFeedImage
}

我可以向左滑动,但是当我向右滑动时,应用程序崩溃,我得到(lldp)错误。任何帮助非常感谢!

0 个答案:

没有答案