使用iPhone SDK将文本复制到剪贴板 [英] Copy text to clipboard with iPhone SDK
本文介绍了使用iPhone SDK将文本复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在您的应用程序中将文本复制到iPhone的剪贴板上的最佳方式是什么?
What is the best way to copy text to the iPhone's clipboard in your application?
他们的文档是粗略的,具有比我想要的更多的功能...我只想设置一个字符串作为用户剪贴板。
Their docs are sketchy and have way more features than what I want... I just want to set a string as the users clipboard.
推荐答案
虽然接受的答案是UIPasteboard如何工作的一个很好的演练,我想我会在这里发布相关的代码段为大家的方便:
Although the accepted answer is a good walkthrough of how UIPasteboard works, I figured I'd post the relevant snippet right here for everyone's convenience:
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = @"paste me somewhere";
这篇关于使用iPhone SDK将文本复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文