开发者

Copying a text from UILabel in iPhone

开发者 https://www.devze.com 2023-03-09 04:54 出处:网络
I have a situation where i want开发者_运维知识库 to copy the text from UILabel as a default cut/copy menu which appears in iPhone.I know that i can use a UITextField for enabling this menu but the key

I have a situation where i want开发者_运维知识库 to copy the text from UILabel as a default cut/copy menu which appears in iPhone.I know that i can use a UITextField for enabling this menu but the key pad pops up and when i make the editing to return no,the keypad is not showing up and the default copy/cut menu is also not showing up.

I tried to use UITextView and unchecked the diting property in the properties of the UITextView,but it didn't gave me a proper solution.Because when the font exceeds the UITextView's height. It goes to the next line and it cannot be aligned properly in a view which i have now.

I came across this post "Show iPhone cut copy paste menu on UILabel" in stack overflow itself which says the same functionality which I need.

I downloaded the source code from git but I got 23 errors.

How can implement this ?


This github project is compiled fine and I have tested it it's working

UILabel copy using menu


You may also want to check out HTCopyableLabel on GitHub. It's a UILabel subclass that makes copying text easy.

0

精彩评论

暂无评论...
验证码 换一张
取 消