In my project I've added TTTAttributedLabel to a view in IB and added a link to it.
I've looked through similar questions on SO (like this and this), but no luck.
It displays properly, link is styled as expected. But -(void)attributedLabel:didSelectLinkWithURL:
is not being called when I try to tap on the link. But if I use a long press instead -(void)attributedLabel:didLongPressLinkWithURL:atPoint:
is fired as expected. So I'm sure the delegate is working. It seems like label doesn't even have a tapGestureRecognizer
(lldb) po label.gestureRecognizers
<__NSSingleObjectArrayI 0x60800000ee60>(
<UILongPressGestureRecognizer: 0x7f88f6c5d480; state = Began; view = <TTTAttributedLabel 0x7f88f6f8ada0>; target= <(action=longPressGestureDidFire:, target=<TTTAttributedLabel 0x7f88f6f8ada0>)>>
)
Here's the code:
RFStaticAttributedLabelFormView *labelView = [RFStaticAttributedLabelFormView new];
labelView.staticLabel.userInteractionEnabled = YES;
labelView.staticLabel.delegate = self;
NSString *text = RFLocalized(@"TXT_FINES_SEARCH_FNS");
[labelView.staticLabel setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:nil];
NSRange r = [text rangeOfString:RFLocalized(@"TXT_FINES_SEARCH_FNS_LINK")];
[labelView.staticLabel addLinkToURL:[NSURL URLWithString:@"http://www.google.com"] withRange:r];
RFStaticAttributedLabelFormView is a view, that is instantiated from XIB.
Not sure where to go from here.