How do you copy a string onto the clipboard (Pasteboard) in iOS?

旧城冷巷雨未停 提交于 2019-12-12 02:59:58

问题


How do you copy a string onto the clipboard in iOS? I searched for "clipboard" in the docs, and got no hits.


回答1:


Like this:

    [UIPasteboard generalPasteboard].string = @"hello!";

Apple doesn't use the term "clipboard"; in iOS it's a "pasteboard", and you can have more than one of them.




回答2:


In Swift 3.0 below code will help to copy text on PasteBoard

let pasteBoard = UIPasteboard.general
pasteBoard.string = "Lorem Ipsum"


来源:https://stackoverflow.com/questions/13054014/how-do-you-copy-a-string-onto-the-clipboard-pasteboard-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!