Domanda

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.

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top