I have a text view, where I want to detect links, but when there isn't a link at the touch point, it should propagate the touch to view below (it currently doesn't). It will be contained in a table view cell, and if the user taps a link, it should interact (it works), but when another point is tapped, it should select the table view cell.
I needed text to be unselectable, so I've followed https://stackoverflow.com/a/27264999/811405 and implemented:
-(BOOL)canBecomeFirstResponder{
return NO;
}
It wasn't sending the touch events below before that too, but I've included it just is case it interferes with a solution.
Here is a Swift version of @Dalzhim's answer, incorporating the adjustment from @jupham to check that
point
is actually contained withinglyphRect
.Instead of preventing your text view from becoming first responder, you need to subclass the
hitTest
method so that it returns the textView when the click occured inside a link and return nil otherwise.