Chapter 22. Implementing Cut, Copy, and Paste

In This Chapter

Understanding copy and paste with default UI components
Working with the UIPasteboard class
Adding copy and paste to a custom UIView

One of the most eagerly anticipated new features in iPhone OS 3 is also seemingly one of the most fundamental. That feature is cut, copy, and paste. Prior to iPhone OS 3, there was no systemwide cut, copy, and paste feature provided as part of the operating system. With the introduction of iPhone OS 3, you not only have this feature, but also application-specific and even vendor-specific copy-and-paste capabilities.

The systemwide pasteboard enables you to copy and paste any type of content, from text to images, and share it among any applications on the system that support the data type that you've placed into it.

To share data amongst a specific subset of applications, an individual application, or even a suite of applications, you can also create a named pasteboard. Applications that know the name of the pasteboard can access the data on that pasteboard. This makes it possible for applications to share data amongst themselves, but not necessarily with the rest of the system.

Pasteboards in iPhone OS 3 can also be persistent, meaning that their contents are retained even if the application is terminated.

Copying and Pasting with Standard Controls

When it comes to working with the standard UITextView, UIWebView, and UITextField objects, there's really nothing you need to do to implement copy and ...

Get Cocoa Touch™ for iPhone® OS 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.