Implementing Cut, Copy, and Paste

Custom subclasses of NSView and NSControl need to implement the -cut:, -copy:, and -paste: action methods if they want to support cut, copy, and paste operations. Because these actions are only sent to the first responder, it only makes sense to implement them for objects that accept first responder status. Sometimes, it might make sense to implement these actions in an NSDocument class instead of a view. (Any class in the responder chain could implement them.)

NOTE

The NSTextView class is different. The -cut:, -copy:, and -paste: actions should not be overridden in subclasses of NSTextView. Instead, there is a large group of methods that should be overridden to extend the existing NSTextView cut, copy, and ...

Get Cocoa® Programming 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.