Skip to content

Instantly share code, notes, and snippets.

@vendruscolo
Last active December 18, 2015 16:18
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 vendruscolo/5809976 to your computer and use it in GitHub Desktop.
Save vendruscolo/5809976 to your computer and use it in GitHub Desktop.
#import "MyAttributedLabel.h"
- (void)someMethod {
self.contentLabel = [[MyAttributedLabel alloc] initWithFrame:CGRectZero];
self.contentLabel.textAlignment = NSTextAlignmentRight;
// all of these are not required, but are pulled from my code
self.contentLabel.backgroundColor = [UIColor clearColor];
self.contentLabel.textColor = [UIColor lightGrayColor];
self.contentLabel.numberOfLines = 0;
self.contentLabel.lineBreakMode = UILineBreakModeWordWrap;
self.contentLabel.font = [UIFont systemFontOfSize:kMessageLabelFontSize];
[self.contentView addSubview:_contentLabel];
}
#import TTTAttributedLabel.h
@interface MyAttributedLabel : TTTAttributedLabel
@end
#import "MyAttributedLabel.h"
@implementation MyAttributedLabel
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.dataDetectorTypes = NSTextCheckingTypeLink;
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment