0

I've a label shown in screenshot below.

screenshot

When user taps on Terms and condition text of UILabel it should be able to redirect to new view controller.

There are few concerns:

  1. Redirect should happen on when Terms and condition text region is tapped. Not on other text.
  2. Terms and condition can come different lines (in case of iPhone 4)

How can this be acheived?

Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
  • Use `UIButton` for the `Terms Of Use`. – Sachin Vas Oct 06 '16 at 11:02
  • Why not to use two different labels with one being touchable? – Max Pevsner Oct 06 '16 at 11:02
  • Well i guess you will need to add 2 Labels, one with text "I understand and accept the" and second "Terms of Use". Then the label two, enable its user interaction and check this http://stackoverflow.com/questions/27064687/adding-tapgesturerecognizer-to-uilabel-in-swift – gurmandeep Oct 06 '16 at 11:02

1 Answers1

3

What you can do is use UITextView instead of UILabel.

Then you can use the  AttributedString to create hyperlinks inside UITextView and catch them using UITextViewDelegate to perform segues.

Here are more details about this approach

Community
  • 1
  • 1
Dejan Skledar
  • 11,280
  • 7
  • 44
  • 70