How do you copy a string onto the clipboard in iOS? I searched for "clipboard" in the docs, and got no hits.
Asked
Active
Viewed 3,496 times
0
-
"UIPasteboard" will give better results. – Phillip Mills Oct 24 '12 at 16:59
-
2Possible duplicate of [Copy text to clipboard with iPhone SDK](http://stackoverflow.com/questions/1479468/copy-text-to-clipboard-with-iphone-sdk) – Suragch Mar 12 '16 at 07:25
2 Answers
5
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.

c roald
- 1,984
- 1
- 20
- 30
0
In Swift 3.0
below code will help to copy text on PasteBoard
let pasteBoard = UIPasteboard.general
pasteBoard.string = "Lorem Ipsum"

Bhavin_m
- 2,746
- 3
- 30
- 49