UITapGestureRecognizer& UIDataDetectorTypes同时工作

时间:2015-04-16 11:26:02

标签: ios swift uitextview uigesturerecognizer

我有一个像这样的UITapGestureRecognizer:

var tap = UITapGestureRecognizer(target: self, action: "dismissIfKeyboardIsShowing")
view.addGestureRecognizer(tap)

// This part is because I have other gestures
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    return true
}

像这样的UITextView:

    var aTextView = UITextView(frame: CGRect(x: x, y: y, width: width, height: height))
    aTextView.font = UIFont(name:ThemeFontName, size: fontSize)
    aTextView.backgroundColor = UIColor.clearColor()
    aTextView.textColor = ThemeNicknameColor
    aTextView.clipsToBounds = true
    aTextView.textAlignment = NSTextAlignment.Left
    aTextView.userInteractionEnabled = true
    aTextView.editable = false
    aTextView.scrollEnabled = false

    aTextView.dataDetectorTypes = UIDataDetectorTypes.Link // -- !!!!!!!!!!!!!

    view.addSubview(aTextView)

一切看起来都不错,除非我点击链接而我的“点击”被禁用我没有问题,链接会按预期将我发送到Safari。

当我启用“点按”时点击该链接时,只有“点击”正在运行且该链接不再有效。

我该如何解决这个问题?

0 个答案:

没有答案