Chapter 21. Copy and Paste
This chapter examines the copy and paste capabilities of the iPhone OS and the supporting APIs. We start in Section 21.1 by discussing pasteboards. In Section 21.2, you learn about pasteboard items and the various methods available to you to manipulate them. In Section 21.3, we address the subject of the Editing Menu which is used by the user to issue editing commands. Section 21.4 puts all the ideas behind copy and paste together and presents a simple image editing application. Finally, we summarize the chapter in Section 21.5.
Pasteboards
Pasteboards are regions in memory that are shared among applications. The system can have an unlimited number of pasteboards where each pasteboard is uniquely identified by a name. A pasteboard can be configured to be persistent across application and device restarts.
System pasteboards
Two persistent system pasteboards are defined for you:
General pasteboard. The General pasteboard, identified by the unique name
UIPasteboardNameGeneral
, can be used to store any type of information.Find pasteboard. The Find pasteboard, identified by the name
UIPasteboardNameFind
, is used to store the search text that the user enters in the search bar.
Creating pasteboards
A pasteboard is represented by the class UIPasteboard
. You can obtain a reference to a system pasteboard using one of the methods of this class. For example, to obtain the shared instance of the General pasteboard, you can use the generalPasteboard
class method. To obtain ...
Get iPhone SDK 3 Programming: Advanced Mobile Development for Apple iPhone and iPod touch 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.