One question that seems to come up time and time again is how to create tappable words within a UILabel. Earlier I mentioned an open source project providing a solution, but that project seems to have developed some issues.
Here’s a new library from Sebastian Thibeaud that makes it easy to create tappable words inspired by the Twitter syntax making words prefixed with @ or # clickable along with http links with a very simple callback system that uses the tagged word. You can also define the colors for the different tags.
Here’s an example given on the Github page of the library in use:
[tweetLabel setFont:[UIFont fontWithName:@"HelveticaNeue" size:17.0]];
[tweetLabel setTextColor:[UIColor blackColor]];
[tweetLabel setText:@"Hi. This is a new tool for @you! Developed by->@SebThiebaud for #iPhone #ObjC... ;-) My GitHub page: https://t.co/pQXDoiYA"];
And an image from the demo app with the #ObjC tag clicked:
You can find STTweetLabel on Github here.
Looks like a good solution if you’re looking to create tappable words within a UIView.
Submit A Resource
Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?
You can submit the url here.
The resources we feel will appeal to our readers the most will be posted on the front page.