Im looking at some source code written by someone else and its intrigues me to see this line:
@interface UITableView (MyTableViewGestureDelegate)
Now I have previously seen only this:
@interface MyTableView : UITableView <MyTableViewGestureDelegate>
so I am a lil confused.
Any ideas as what to what im looking at?
Ben
It is a category declaration.
The declaration of a category interface looks very much like a class interface declaration—except the category name is listed within parentheses after the class name and the superclass isn’t mentioned. Unless its methods don’t access any instance variables of the class, the category must import the interface file for the class it extends:
General Syntax:
Note that a category can’t declare additional instance variables for the class; it includes only methods. However, all instance variables within the scope of the class are also within the scope of the category. That includes all instance variables declared by the class, even ones declared @private.
There’s no limit to the number of categories that you can add to a class, but each category name must be different, and each should declare and define a different set of methods.
Please check the link and Example