THLabel for iOS
THLabel is a subclass of UILabel, which additionally allows shadow blur, stroke text and fill gradient.

THLabel is a subclass of UILabel, which additionally allows shadow blur, stroke text and fill gradient.

Cocoa Touch is absolutely amazing if you need to complete a sophisticated task like getting the GPS location of the device anywhere in the world, make an HD video and send it over to your web server, or get the orientation of the user towards the north pole.
However for quite some time now it’s been relatively complicated to do some simple text formatting – like having a bold word in the middle of a sentence, for example when using a UILabel. Also something that I often wished for was to have a button, which mimics a hyperlink, like the one on the image below:
Another one of those things is making the words clickable in a UILabel. I’ve seen some very complex suggestions on how to do this voted up on Stackoverflow that will likely just waste a lot of time – so when i came across this component I thought it would be good share.
Here’s a video showing the control in action:
The library is GLTapLabel form German Lallon, and it works simply by calculating the frame size of the words, and turning each into a clickable area.
GLTapLabel is a drop-in replacement for UILabel and includes a delegate (GLTapLabelDelegate.h) and the class that you set as the delegate will receive callbacks including the word that has been tapped (an example is included).
You can find GLTapLabel and the example at the Github repo .
The default behavior is for GLTapLabel to only make words beginning with the symbols “@” or “#” clickable so if you want to change that behavior like in the video look for the “BOOL hot” variable and remove it’s declaration and the associated if statement.
A nice solution to a common problem.
Some time ago I mentioned an excellent UILabel replacement that allowed for the .
The library that I’m mentioning today also provides a UILabel replacement, and can even be used in interface builder. This library is for those times when you are looking for very fanciful text and supports shadows, and gradients.
Here’s a screenshot of the example running showing a few of the text effects that can be created:
You can find the library on Github here:
A very useful library since all you need to do is drop it right in as a UILabel replacement.
Add framework QuartzCore
#import <QuartzCore/QuartzCore.h> UILabel *label = [[UILabel alloc] init]; [label setTextColor:[UIColor whiteColor]]; [label setBackgroundColor:[UIColor darkGrayColor]]; [[label layer] setBorderWidth:2]; [[label layer] setCornerRadius:15]; [[label layer] setBorderColor:[UIColor whiteColor].CGColor]; [label setAlpha:0.8]; [label setTextAlignment:UITextAlignmentCenter]; [label setFrame:CGRectMake(0, 0, 220, 50)]; [label setText:@"Loading..."]; [label setCenter:window.center]; [window addSubview:label];
Result:

Recent Comments