Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please give me a hand~ I wanna know how to make UILabel have a system Clipboard(e.g. copy and select) like UITextField (UITextView、UIWebView) when it has a long press, which makes me can copy the text I want. I have read some demo on Github, however, they always only contain copy function, which makes me can't choose the text I want to copy. At present I wanna implement "select" on UILabel but I don't know how to work out.
Can I use UITextField without editing function? But once I turn off editing function, there is no system Clipboard when it has a long press. Or if there is a simpler method to work out? Thanks!
Posted
Updated 24-Dec-16 0:56am

In the interface builder of XCode you can set the option "Selectable" in the Attribute inspector for an UILabel.
 
Share this answer
 
Comments
Elijah_Lam 18-Feb-15 10:20am    
No, you didn't get my idea! I mean I wanna select some text of a label, and copy it to the clipboard. e.g. : label.text = @"hey guys!", and I wanna select "guy" or what I want to copy.
mybe you should use coretext to calculate the press position to get the rang the user select.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900