UITapGestureRecognizer & UIDataDetectorTypes works simultaneously

I have a 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
}

And a UITextView like this:

    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)

Everything looks good, except when I click on the link while my "answer" is disabled. I have no problem, and the link sends me to Safari, as expected.

When I click on a link while my “answer” is on, only “tap” works and the link no longer works.

How can i solve this?

+4
source share

All Articles