All Projects → indragiek → INDLinkLabel

indragiek / INDLinkLabel

Licence: MIT license
A simple, no frills UILabel subclass with support for links

Programming Languages

swift
15916 projects

INDLinkLabel

A simple, no frills UILabel subclass with support for links

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:

Example app

Handling Link Actions

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)

Limitations

UILabel's adjustsFontSizeToFitWidth property (and its associated properties) are not supported.

Contact

License

INDLinkLabel is licensed under the MIT License. See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].