-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
  • 7,285
  • 1
  • 33
  • 51
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
  • 314,917
  • 42
  • 532
  • 579
Basheer
  • 1,207
  • 9
  • 10