Skip to content

A simple subclass of UILabel that allows users to copy text with a long press. Handles highlighting the label as needed.

License

Notifications You must be signed in to change notification settings

markiv/PPCopiableLabel

Repository files navigation

PPCopiableLabel

A simple subclass of UILabel that allows users to copy text with a long press. Handles highlighting the label as needed.

PPCopiableLabel can be used as a drop-in replacement for UILabel. You can simply change the custom class of any UILabel in Interface Builder, and now that label will have the ability to display the Copy menu when pressed for a second.

While it displays the menu, the label changes to highlighted state, so you can easily customize its appearance with UILabel's highlightedTextColor property, or within Interface Builder, as shown in the demo.

label.highlightedTextColor = [UIColor redColor];

If no highlight color is specified, PPCopiableLabel takes over the label's tintColor, which is blue by default on iOS 7.

Installation

Install via Cocoapods. Here's a sample Podfile:

pod 'PPCopiableLabel'

Alternatively, just drop the two files (PPCopiableLabel.m and PPCopiableLabel.h) into your project tree.

Contact

Vikram Kriplaney

License

PPCopiableLabel is available under the MIT license. See the LICENSE file for more info.

About

A simple subclass of UILabel that allows users to copy text with a long press. Handles highlighting the label as needed.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published