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"