FRHyperLabel icon indicating copy to clipboard operation
FRHyperLabel copied to clipboard

Is there an issue with Tableview support?

Open dmathewwws opened this issue 9 years ago • 7 comments

Hi,

Ran the Demo project and it works perfectly, tried integrating into a tableview and even though it looks great visually, I ran into the following issues:

  • the handler is not triggered when I click on the attributed link portion of the label
  • When I click on any part of the label, the didSelectRowAt delegate method on the tableView is not triggered.

I made an example project, https://github.com/dmathewwws/FRHyperLabel-Tableview to showcase the issues I am talking about.

Thanks, Daniel

dmathewwws avatar Feb 02 '17 01:02 dmathewwws

Just to add to this, I'm having this exact same issue. The handler is not triggering no matter what I try if I embed this label into a tableViewCell which is then contained in a tableView.

aravasio avatar Mar 04 '17 05:03 aravasio

Is there a solution for this?

koenvanderdrift avatar Apr 16 '17 20:04 koenvanderdrift

@koenvanderdrift Not that I know of. As far as I was able to track, there seems to be an issue with line 174: NSInteger indexOfCharacter = -1; or, rather, the fact that it never changes from -1 by not entering the following for instruction, which, I guess it follows, is caused by lines being am empty array.

Now, how that comes to be escapes my understanding of the lower levels of the SDK.

aravasio avatar Jun 12 '17 14:06 aravasio

Having the same :/

alasmanis avatar Jun 20 '17 08:06 alasmanis

this seems to do the trick for me: `- (NSInteger) characterIndexForPoint:(CGPoint) point {

// init text storage
NSTextStorage *textStorage = [[NSTextStorage alloc] initWithAttributedString:self.attributedText];
NSLayoutManager *layoutManager = [[NSLayoutManager alloc] init];
[textStorage addLayoutManager:layoutManager];

// init text container
NSTextContainer *textContainer = [[NSTextContainer alloc] initWithSize:CGSizeMake(self.frame.size.width, self.frame.size.height+100) ];
textContainer.lineFragmentPadding  = 0;
textContainer.maximumNumberOfLines = self.numberOfLines;
textContainer.lineBreakMode        = self.lineBreakMode;

[layoutManager addTextContainer:textContainer];

NSUInteger characterIndex = [layoutManager characterIndexForPoint:point
                                                  inTextContainer:textContainer
                         fractionOfDistanceBetweenInsertionPoints:NULL];

return (NSInteger)characterIndex;

}` Courtesy Of https://stackoverflow.com/a/26806991

alasmanis avatar Jun 20 '17 08:06 alasmanis

@alamanis does this change impact functionality out of the tableview scope? if not, please consider creating a PR.

aravasio avatar Jun 20 '17 12:06 aravasio

Hello I am having same issue in tableview.While having different words handler working fine.But if word are used in more than one times in cell .so that word is not identifying the handler.If anyone solved this poblem let me know

JaisinghSisodia avatar Sep 09 '17 07:09 JaisinghSisodia