Created
August 7, 2019 05:52
-
-
Save leoiphonedev/a69f5db06bfed25db47679005bafa2d4 to your computer and use it in GitHub Desktop.
Selector for UITapGestre added to UILable and telling us wether user tap on desired text or not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//MARK:- tappedOnLabel | |
@objc func tappedOnLabel(_ gesture: UITapGestureRecognizer) { | |
guard let text = self.lblTermsAndConditions.text else { return } | |
let privacyPolicyRange = (text as NSString).range(of: "privacy policy") | |
let termsAndConditionRange = (text as NSString).range(of: "terms and condition") | |
if gesture.didTapAttributedTextInLabel(label: self.lblTermsAndConditions, inRange: privacyPolicyRange) { | |
print("user tapped on privacy policy text") | |
} else if gesture.didTapAttributedTextInLabel(label: self.lblTermsAndConditions, inRange: termsAndConditionRange){ | |
print("user tapped on terms and conditions text") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment