This version of CopyLabel adds additional functionality to zoul's original repo:
- The code uses ARC. If you're using this code in a non-ARC project, make sure to add
-fobjc-arc
to the compiler flags of CopyLabel.m - When
highlightedTextColor
is set, the entire label highlights when the menu is visible - By default, the label copies its text to the clipboard. However, you can set a custom copy action by calling
- (void)setTarget:(id)target forCopyAction:(SEL)action;
. This functionality is demonstrated in the sample project.
Original Readme by zoul
This is a simple project demonstrating how you can display the system
pasteboard menu on a regular UILabel
. The interesting code is in the
CopyLabel.m
class. Originally motivated by this question
on Stack Overflow. Released to public domain under the CC0 license.