O'Reilly logo

COCOA PROGRAMMING FOR MAC OS X SECOND EDITION by Aaron Hillegass

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

Chapter 19. Categories

Although the engineers at Apple are very wise, one day you will think, “Golly, if only they had put that method on that class, my life would be so much easier.” When this happens, you will want to create a category. A category is simply a collection of methods that you would like added to an existing class. The category concept is very useful, and I find it surprising that so few object-oriented languages include this powerful idea.

Creating categories is easier than talking about them. In Chapter 18, you added pasting capabilities to your BigLetterView. Notice, however, that if the string on the pasteboard has more than one letter, the paste attempt will fail, because BigLetterView is capable of displaying only one letter ...

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