Re: @interface MyController for ThumbnailMatrix.h? Why? Confused?
Re: @interface MyController for ThumbnailMatrix.h? Why? Confused?
- Subject: Re: @interface MyController for ThumbnailMatrix.h? Why? Confused?
- From: Andy Lee <email@hidden>
- Date: Sun, 16 Jan 2005 20:27:58 -0500
On Jan 16, 2005, at 8:03 PM, James Andrews wrote:
@interface MyController (ThumbnailMatrix)
I don't understand why the interface is called "MyController
(ThumbnailMatrix)" instead of just ThumbnailMatrix. What does this
do, and why would it be done?
You are looking at the declaration of a category, not a class. A
category is a way of adding methods to a class separately from the main
class declaration. The main reasons to do this are:
* to extend the behavior of a class you don't have source for,
* to group methods into logical bunches if your class has a lot of
them, or
* to declare what's called an "informal protocol."
Another reason would be if you want to determine the behavior of your
class at runtime -- you could load the appropriate bundle containing
the category.
To read up on categories, you could start here:
<http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/
LanguageOverview/chapter_3_section_7.html#//apple_ref/doc/uid/20001424/
TPXREF139>
--Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden