Swift 3.0
Zainicjuj gest dla tempLabel
tempLabel?.text = "Label"
let tapAction = UITapGestureRecognizer(target: self, action: #selector(self.actionTapped(_:)))
tempLabel?.isUserInteractionEnabled = true
tempLabel?.addGestureRecognizer(tapAction)
Odbiornik akcji
func actionTapped(_ sender: UITapGestureRecognizer) {
}
Swift 4.0
Zainicjuj gest dla tempLabel
tempLabel?.text = "Label"
let tapAction = UITapGestureRecognizer(target: self, action:@selector(actionTapped(_:)))
tempLabel?.isUserInteractionEnabled = true
tempLabel?.addGestureRecognizer(tapAction)
Odbiornik akcji
func actionTapped(_ sender: UITapGestureRecognizer) {
}
userInteractionEnabled = true