mac_ch15.eps
co_bar.eps

Chapter 15: Working with Text and Documents

mac_chbox15.eps

In This Chapter

Using NSString

Using NSAttributedString

Creating multi-document applications

Implementing undo and redo

Supporting other languages

Cocoa includes classes that implement powerful multi-language text features and drastically simplify the design of documents that support styled and formatted text. An associated Xcode template makes it easy to create an application that supports multiple editing windows. Each window is an instance of a customizable MyDocument class, which is a subclass of NSDocument — Cocoa's document object. You can define the look and feel of this class, by customizing its associated nib, and add custom code to implement saving and loading features for customized and existing file formats.

Using NSString

NSString is Cocoa's string-handling class. It supports a vast library of methods that can initialize, convert, compare, split, combine, and process string data.

NSString objects are read-only. You can create edited strings by copying the output of one of the string-processing methods to a new string. You can also use NSMutableString, which implements insert, delete, and replace methods.

Table 15.1 lists ...

Get Cocoa® now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.