Skip to content

Instantly share code, notes, and snippets.

@phynet
Last active January 13, 2016 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phynet/c9009a2e5493853e9edf to your computer and use it in GitHub Desktop.
Save phynet/c9009a2e5493853e9edf to your computer and use it in GitHub Desktop.
Category to create an attributed label for Obj-c
@implementation UILabel (AttributedLabel)
-(NSAttributedString*)spaceBetweenChars:(int)spaceValue{
NSMutableAttributedString *attributedString;
attributedString = [[NSMutableAttributedString alloc] initWithString:self.text];
[attributedString addAttribute:NSKernAttributeName value:@(spaceValue) range:NSMakeRange(0, 0)];
[self setAttributedText:attributedString];
return self.attributedText;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment