Sono nuovo allo sviluppo iOS.sottolineano parte di uiLabel e collegamento sottolineato sezione
Ho un'etichetta LatestInfo
questo ha un testo e ha lo scopo di avere un collegamento a un sito Web: ad es. For the latest information visit example.com/latestInfo
Desidero che il display sottolinei l'url example.com/latestInfo
e lo renda cliccabile.
Sto usando Swift non Obejective-C
Come posso fare per fare questo?
EDIT secondo la richiesta di Pierre:
@IBOutlet weak var linkLabel: UITextView!
let string = "A great link : Google"
let range = (string as NSString).rangeOfString("Google")
let attributedString = NSMutableAttributedString(string: string)
attributedString.addAttribute(NSLinkAttributeName, value: NSURL("http://www.google.fr")!, range: range)
attributedString.addAttribute(NSUnderlineStyleAttributeName, value: NSNumber(int: 1), range: range)
attributedString.addAttribute(NSUnderlineColorAttributeName, value: UIColor.orangeColor(), range: range)
linkLabel.attributedText = attributedString
un'occhiata a questo [SO] (http://stackoverflow.com/questions/28053334/how-to-underline- a-uilabel-in-swift) link – Akhilrajtr