I want to create a clickable label on my app leading me to a Safari webpage. I also want the user to be able to phone the numbers only by clicking on them ?
Thanks for your advices
I want to create a clickable label on my app leading me to a Safari webpage. I also want the user to be able to phone the numbers only by clicking on them ?
Thanks for your advices
Use this i liked it so much since creates link with blue color to particular text only not on whole label text: FRHyperLabel
To do:
Download from above link and copy
FRHyperLabel.h
,FRHyperLabel.m
to your project.Drag drop
UILabel
in yourStoryboard
and define custom class name toFRHyperLabel
in identify inspector as shown in image.@property (weak, nonatomic) IBOutlet FRHyperLabel *label;
`NSString *string = @"By uploading I agree to the Terms of Use"; NSDictionary *attributes = @{NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]};
Use UITextView instead of UILabel and it has a property to convert your text to hyperlink
Swift code:
Swift 4.2, Xcode 9.3 version
https://github.com/mattt/TTTAttributedLabel
That's definitely what you need. You can also apply attributes for your label, like underline, and apply different colors to it. Just check the instructions for clickable urls.
Mainly, you do something like the following: