-2

What I want to do is click the label and it will lead to another page. Now I am making iOS application using Xcode. I found the information about this in internet but couldn't find related information.

How can I do this?

nayem
  • 6,667
  • 1
  • 29
  • 50
Lolly Lun
  • 55
  • 1
  • 10

2 Answers2

3

You can add a tap gesture like this:

 let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapOnLabel(gesure:)))
 YOUR_Label.addGestureRecognizer(tapGesture)

 func didTapOnLabel(gesure:UITapGestureRecognizer){
    //handle your action here
  }
0

You can add UITapGestureRecognizer on your label and trigger the action on tap.

rmaddy
  • 307,833
  • 40
  • 508
  • 550
Basheer
  • 1,177
  • 8
  • 10