从 iPhone 中的 UILabel 复制文本
我有一种情况,我想从 UILabel 复制文本作为 iPhone 中出现的默认剪切/复制菜单。我知道我可以使用 UITextField 来启用此菜单,但键盘会弹出,当我进行编辑时返回否,键盘没有显示,默认的复制/剪切菜单也没有显示。
我尝试使用 UITextView 并取消选中 UITextView 属性中的 diting 属性,但它没有给我一个正确的解决方案。因为当字体超过 UITextView 的高度时。它转到下一行,并且无法在我现在拥有的视图中正确对齐。
我看到这篇文章“在 UILabel 上显示 iPhone 剪切复制粘贴菜单”在堆栈溢出本身中,它表示我需要的相同功能。
我从 git 下载了源代码,但出现了 23 个错误。
如何实现这一点?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个github项目编译得很好,我已经测试过它可以工作
UILabel copy using menu
This github project is compiled fine and I have tested it it's working
UILabel copy using menu
您可能还想查看 GitHub 上的 HTCopyableLabel。它是 UILabel 子类,可以轻松复制文本。
You may also want to check out HTCopyableLabel on GitHub. It's a UILabel subclass that makes copying text easy.