0

I'm creating attributed strings in several positions in a UILabel. How can I detect a tap on each one of them, and how can I detect which one has been tapped? Is there a way to do it?

This is how I'm adding my attributed string:

    let anotherAttribute = [NSBackgroundColorAttributeName: UIColor.yellow ]
    let attributedString: NSMutableAttributedString = NSMutableAttributedString(string: "hello my name is bla", attributes: anotherAttribute
    attributedString.addAttributes(anotherAttribute, range: NSRange(location: 9, length: 4))
    self.descLabel.attributedText = attributedString

Any help? Thanks!

Finni McFinger
  • 226
  • 4
  • 14
Marc Ibrahim
  • 299
  • 5
  • 18

0 Answers0