美文网首页
Limit horizontal pan

Limit horizontal pan

作者: hoody | 来源:发表于2015-02-15 06:12 被阅读25次

    From Making a Gesture-Driven To-Do List App Like Clear in Swift: Part 1/2

    override func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer) -> Bool {
        if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
            let translation = panGestureRecognizer.translationInView(superview!)
            if fabs(translation.x) > fabs(translation.y) {
                return true
            }
            return false
        }
        return false
    }
    

    相关文章

      网友评论

          本文标题:Limit horizontal pan

          本文链接:https://www.haomeiwen.com/subject/ngiexttx.html