iOS Reference Library Apple Developer
Search

UIResponderStandardEditActions Protocol Reference

(informal protocol)

Framework
/System/Library/Frameworks/UIKit.framework
Declared in
UIResponder.h

Overview

The UIResponderStandardEditActions informal protocol declares methods that responder classes should override to handle common editing commands invoked in the user interface, such as Copy, Paste, and Select.

Although this is an informal protocol—that is, a category declared on NSObject—it is recommended that responder classes (that is, immediate or distant ancestors of UIResponder) override its methods. Starting with the first responder, UIResponder looks for a responder object that can handle the method, and works up the responder chain from there. Responder classes may also implement the canPerformAction:withSender: method of UIResponder to disable or enable user-interface commands based on the context. The copy:, cut:, delete:, paste:, select:, and selectAll: methods are invoked when users tap the corresponding command in the menu managed by the UIMenuController shared instance.

Tasks

Handling Copy, Cut, Delete, and Paste Commands

Handling Selection Commands

Instance Methods

copy:

Copy the selection to the pasteboard. (required)

- (void)copy:(id)sender

Parameters
sender

The object calling this method.

Discussion

This method is invoked when the user taps the Copy command of the editing menu. A subclass of UIResponder typically implements this method. Using the methods of the UIPasteboard class, it should convert the selection into an appropriate object (if necessary) and write that object to a pasteboard. The command travels from the first responder up the responder chain until it is handled; it is ignored if no responder handles it. If a responder doesn’t handle the command in the current context, it should pass it to the next responder.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIResponder.h

cut:

Remove the selection from the user interface and write it to the pasteboard. (required)

- (void)cut:(id)sender

Parameters
sender

The object calling this method.

Discussion

This method is invoked when the user taps the Cut command of the editing menu. A subclass of UIResponder typically implements this method. Using the methods of the UIPasteboard class, it should convert the selection into an appropriate object (if necessary) and write that object to a pasteboard. It should also remove the selected object from the user interface and, if applicable, from the application’s data model. The command travels from the first responder up the responder chain until it is handled; it is ignored if no responder handles it. If a responder doesn’t handle the command in the current context, it should pass it to the next responder.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIResponder.h

delete:

Remove the selection from the user interface. (required)

- (void)delete:(id)sender;

Parameters
sender

The object calling this method.

Discussion

This method is invoked when the user taps the Delete command of the editing menu. A subclass of UIResponder typically implements this method by removing the selected object from the user interface and, if applicable, from the application’s data model. It should not write any data to the pasteboard. The command travels from the first responder up the responder chain until it is handled; it is ignored if no responder handles it. If a responder doesn’t handle the command in the current context, it should pass it to the next responder.

See Also
Availability
  • Available in iOS 3.2 and later.
Declared In
UIResponder.h

paste:

Read data from the pasteboard and display it in the user interface. (required)

- (void)paste:(id)sender

Parameters
sender

The object calling this method.

Discussion

This method is invoked when the user taps the Paste command of the editing menu. A subclass of UIResponder typically implements this method. Using the methods of the UIPasteboard class, it should read the data in the pasteboard, convert the data into an appropriate internal representation (if necessary), and display it in the user interface. The command travels from the first responder up the responder chain until it is handled; it is ignored if no responder handles it. If a responder doesn’t handle the command in the current context, it should pass it to the next responder.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIResponder.h

select:

Select the next object the user taps. (required)

- (void)select:(id)sender

Parameters
sender

The object calling this method.

Discussion

This method is invoked when the user taps the Select command of the editing menu. This command is used for targeted selection of items in the receiving view that can be broken up into chunks. This could be, for example, words in a text view. Another example might be a view that puts lists of visible objects in multiple groups; the select: command could be implemented to select all the items in the same group as the currently selected item.

A subclass of UIResponder typically implements this method. The command travels from the first responder up the responder chain until it is handled; it is ignored if no responder handles it. If a responder doesn’t handle the command in the current context, it should pass it to the next responder.

Availability
  • Available in iOS 3.0 and later.
Declared In
UIResponder.h

selectAll:

Select all objects in the current view. (required)

- (void)selectAll:(id)sender

Parameters
sender

The object calling this method.

Discussion

This method is invoked when the user taps the Select All command of the editing menu. A subclass of UIResponder typically implements this method by selecting all objects in the current view. The command travels from the first responder up the responder chain until it is handled; it is ignored if no responder handles it. If a responder doesn’t handle the command in the current context, it should pass it to the next responder.

See Also
Availability
  • Available in iOS 3.0 and later.
Declared In
UIResponder.h



Last updated: 2010-02-25

Did this document help you? Yes It's good, but... Not helpful...