In an iPhone app, I\'d like to show information in a tableView. In each cell, the text is like: John recently listen to music abcdefg.mp3. and if neede
Swift 4.2 Version:
var labelView = UILabel()
let gesture = UITapGestureRecognizer(target: self, action: #selector(userTappedOnLink))
// if labelView is not set userInteractionEnabled, you must do so
labelView.isUserInteractionEnabled = true
labelView.addGestureRecognizer(gesture)
@objc func userTappedOnLink() {
print("clicked!")
}