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!
Open the file that you want to copy items from. Select the first item that you want to copy, and press CTRL+C. Continue copying items from the same or other files until you have collected all of the items that you want. The Office Clipboard can hold up to 24 items.
How do I copy a variable to the clipboard? Create an input element and insert the value of variable into it. Select it. Copy it.
Did you refered this link : https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/UsingCopy,Cut,andPasteOperations/UsingCopy,Cut,andPasteOperations.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.
In Swift 3.0
you can copy text on PasteBoard
and paste anywhere. In short, if you want to copy text programmatically then below code will help you.
let pasteBoard = UIPasteboard.general
pasteBoard.string = "copy the text"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With