views:

72

answers:

1

Hi everyone, I'm stuck here. I know how to copy and paste on the iPhone side of things but how can I copy contents from a textField to the global clipboard in OSX. I've been searching the web but there are really no examples. So let me explain in detail what I'm trying to accomplish. I have a NSTextField named helloField and I want to be able to copy the contents of this helloField to the global pasteboard by pressing a button. How can this be done and is there certain libraries I need? Thanks.

+2  A: 

Take a look at the Pasteboard Programming Guide and the NSPasteboard Class Reference. They'll have what you need.

itaiferber
Thanks, I got it working. Some how I was missing those docs when searching the web.
0SX
You don't even have to go to the web; just open XCode's Help --> Documentations. They usually have a rather good documentation. Somehow people just assumes that the web knows better about Apple's own API than Apple does ...
Yuji
The documentation provided through Xcode is the same as the one provided online, or even more outdated, depending on the last time it was updated when Xcode was open. Regardless, since the original poster must have their web browser open when viewing Stack Overflow, it's easier to just open a webpage than open Xcode and sift through the documentation.
itaiferber