如何将字符串复制到剪贴板 [英] How to copy string to clipboard

查看:69
本文介绍了如何将字符串复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何在 xcode 中将文本复制到剪贴板?目前,我正在使用以下代码:

How do you copy text to the clipboard in xcode? Currently, I am using the following code:

UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
        [pasteboard setString:shareString];

当我尝试将其粘贴到另一个模拟器应用程序中时,我最终粘贴了整个视图控制器代码.???提前致谢!

When I try to paste this into another one of the simulator apps, I end up pasting the entire view controller code. ??? Thanks in advance!

推荐答案

您是否参考了此链接:https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/UsingCopy,Cut,andPasteOperations/UsingCopy,剪切和粘贴操作.html

您共享的代码量似乎可以复制文本.可能更多的代码将有助于理解您的问题.同时你可以通过这个链接,它真的很有帮助.

The amount of code you have shared seems ok to copy text. May be more code will be helpful to understand your problem. Meanwhile you can go through this link , it is really helpful.

这篇关于如何将字符串复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆