Frage

Can we give click event for a particular word from a sentence. For example, let my label be 'myLabel.text = @"contact 123@gmail.com";'. I want to give click event for 123@gmail.com. Is it possible in IOS5/IOS6.

Thanks in advance.

War es hilfreich?

Lösung

In iOS5/6 there's a link detection system that will pick out links from a string, however it's not available in UILabel. If you can get away with using a UITextView then it'll work perfectly, if you desperately, definitely need a UILabel you'll need to work around it slightly and use something like TTTAttributedLabel or follow a similar approach and build your own UILabel replacement.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top