All I wanted was a UILabel
that had support for handling taps on links. I didn't want loads of additional styling properties or built in support for parsing links and hashtags. I just wanted to be able to give it an NSAttributedString
that had links already marked using NSLinkAttributeName
and have it handle taps on those links like the way UITextView
does. I couldn't find an existing project that met that criteria so I built this.
Run the example app to see it in action:
INDLinkLabel
provides two delegate methods that are called when a link is tapped or long pressed:
optional func linkLabel(label: INDLinkLabel, didTapLinkWithURL URL: NSURL)
optional func linkLabel(label: INDLinkLabel, didLongPressLinkWithURL URL: NSURL)
UILabel
's adjustsFontSizeToFitWidth
property (and its associated properties) are not supported.
- Indragie Karunaratne
- @indragie
- http://indragie.com
INDLinkLabel
is licensed under the MIT License. See LICENSE
for more information.