UITapGestureRecognizer

public extension UITapGestureRecognizer
  • Find the tapped character location and compare it to the specified range in UILabel. This method will get attributedString from the label, font and paragraphStyle should be configured in the attributedString, otherwise the result may be not correct.

    Declaration

    Swift

    @MainActor
    func didTapAttributedTextInLabel(label: UILabel, inRange targetRange: NSRange) -> Bool

    Parameters

    label

    label which keeps the attributedString.

    targetRange

    specified range to compare.

    Return Value

    Whether the index of tapped character is in the specified range or not.