I am using TTTAttributedLabel
to make UILabel
hyperlink, I am trying to do this as below:
NSAttributedString *attString = [[NSAttributedString alloc] initWithString:@"By tapping you agree to the Terms of Use and Privacy Policy."
attributes:@{
(id)kCTForegroundColorAttributeName : (id)[UIColor redColor].CGColor,
NSFontAttributeName : [UIFont boldSystemFontOfSize:16],
NSKernAttributeName : [NSNull null],
(id)kTTTBackgroundFillColorAttributeName : (id)[UIColor greenColor].CGColor
}];
// The attributed string is directly set, without inheriting any other text
// properties of the label.
self.tttTermAndCondition.text = attString;
self.tttTermAndCondition.delegate = self; // Delegate methods are called when the user taps on a link (see `TTTAttributedLabelDelegate` protocol)
//self.tttTermAndCondition.text = @"Fork me on GitHub! (http://github.com/mattt/TTTAttributedLabel/)"; // Repository URL will be automatically detected and linked
self.tttTermAndCondition.enabledTextCheckingTypes = NSTextCheckingTypeLink;
NSRange range = [self.tttTermAndCondition.text rangeOfString:@"Terms of Use"];
[self.tttTermAndCondition addLinkToURL:[NSURL URLWithString:@"http://github.com/mattt/"] withRange:range];
This shows perfectly fine but when i click the Term Of Use,
The TTTAtributedLabel crashes in its - (NSArray *) links method, It becomes a zombie object.
I dont know what exactly i am missing.
Thanks In Advance.