I was wondering if I could copy some text to the iphone keyboard via code - I.E. They press a button named "Copy Link to Clipboard" and it would copy a link to the Clipboard?
Thanks.
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.
When you copy something on your iPhone, iPad, or Mac, it's saved to the clipboard, ready to be pasted anywhere. However, your previous clipboard is overwritten and lost forever if you copy something else!
A normal string would be copied via
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = @"my test string";
a URL via e.g
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.URL = [NSURL URLWithString:@"http://stackoverflow.com/questions/4060471/iphone-copy-something-to-clipboard-via-code"];
UIPasteboard
is what you need:
http://mobileorchard.com/new-in-iphone-30-tutorial-series-part-3-copy-paste-with-uipasteboard/
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