Closed ms-tii closed 5 years ago
The best way to handle this would be to add a delegate to your UITapGestureRecognizer and make gestureRecognizer(_:shouldReceive:)
return false
if tappableLabel.tappableRegionInfo(at:)
returns non-nil
.
Worked for me, thanks
let gr = UITapGestureRecognizer(target: self, action: #selector(onTapView))
gr.delegate = self
gr.cancelsTouchesInView = false
addGestureRecognizer(gr)
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
let info = descriptionLabel.tappableRegionInfo(at: touch.location(in: descriptionLabel))
return info == nil
}
I have UITapGestureRecognizer method already in my class and after implementing this pod on tap of PrivacyPolicy link, UITapGestureRecognizer method is called instead of ZSWTappableLabelTapDelegate.
Called this method on lable link tap @objc func handleTap(_ gestureRecognizer: UITapGestureRecognizer) { if contentView.frame.origin.y != 0{ if UIDevice.current.userInterfaceIdiom == .pad { moveTextField(moveDistance: 70, up: false) }else{ moveTextField(moveDistance: 0, up: false) } } self.contentView.resignFirstResponder() self.contentView.endEditing(true) }
This delegate is not called
func tappableLabel(_ tappableLabel: ZSWTappableLabel, tappedAt idx: Int, withAttributes attributes: [NSAttributedString.Key : Any] = [:]) { self.performSegue(withIdentifier: kToWebView, sender: nil) }