Krelborn / KILabel

A simple to use drop in replacement for UILabel for iOS 7 and above that highlights links such as URLs, twitter style usernames and hashtags and makes them touchable.
MIT License
470 stars 132 forks source link

add handling of NSLinkAttributedName attribute for URL Link #26

Open vhosune opened 9 years ago

vhosune commented 9 years ago

add handling of NSAttributedString NSLinkAttributedName attribute as an URL link

Krelborn commented 9 years ago

Thanks for doing this. It looks like a fairly straightforward addition.

I think there is one problem where we will end up with duplicate matches if the link text matches the regex and there is a link attribute as well.

When the link attributes block is called it should check the range of the match against the array of matches that was returned by the regex to avoid the clash.

If we don't do this then blocks could get called twice for the same range. The link classifiers should call their tap handler once for each detected range.

Cheers.

vhosune commented 9 years ago

It will take the first match