O'Reilly logo

Cocoa® by Richard Wentk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required