AliSoftware / OHAttributedLabel

UILabel that supports NSAttributedString
https://github.com/AliSoftware/OHAttributedLabel/wiki
1.51k stars 344 forks source link

Links clickable only if at the start of a label #111

Closed lancejjohnson closed 11 years ago

lancejjohnson commented 11 years ago

Thank you for OHAttributedLabel. I'm using it for an iPhone client of a web app my company is developing and it's been a great help.

I'm using an OHAttributedLabel for, among other things, making labels for user-contributed descriptions and/or comments that will automatically detect links. The label detects all the links as far as formatting is concerned but the link is only clickable if the link is at the start of a description/comment label.

I am creating the label using _descriptionLabel = [[OHAttributedLabel alloc] initWithFrame:aFrame]; and then setting it to automatically detect links using [_descriptionLabel setAutomaticallyAddLinksForType:NSTextCheckingTypeLink];

Some examples of the issue:

If the user-contributed description is,

github.com hosts OHAttributedLabel. I love it! You can find it here: https://github.com/AliSoftware/OHAttributedLabel/

the label formats "github.com" and "https://github.com/AliSoftware/OHAttributedLabel/" as links but only the first link, "github.com" is clickable; the second link is formatted correctly but cannot be clicked.

If the user-contributed description is,

I love OHAttributedLabel! You can find it on github.com. The link is: https://github.com/AliSoftware/OHAttributedLabel/

the label formats both "github.com" and "https://github.com/AliSoftware/OHAttributedLabel/" as links but neither of them can be clicked.

My hope is that any and all links in a description will be clickable. Any help you might be able to offer will be greatly appreciated.

Thanks.

lancejjohnson commented 11 years ago

Please ignore this issue. I created an OHAttributedLabel in a different class and all the links are being detected. There must be something else going on in the original class I was using.