What is “category” in Objective-C?
Solution 1
A category allows you to add methods to an existing class—even to one for which you do not have the source.
Categories are a powerful feature that allows you to extend the functionality of existing classes without subclassing
Check the apple doc for the Category in Objective-C
Solution 2
There is a section in the Objective-C 2.0 programming Language document about Categories and Extensions.
As you are just getting started it's a good doc to have on hand to look things up.
There is also a section on Categories in the Cocoa Core Competencies document, which is easier to get started with, and also has a lot of useful information for the beginner.
Comments
-
wOlVeRiNe about 4 years
Possible Duplicate:
How does a category work in Objective-C?I am just getting started with Objective-C and was wondering when and where am i supposed to use category in objective C. is it a class or a protocol? An explanatory example would be of great help. Thanks
-
Alex Bitek about 11 yearsCategories in Objective-C are similar to Ruby open classes and C# extension methods
-
Basil Bourque over 10 yearsThat first link is now obsolete. Apple redirects to listing of documentation.
-
Arc676 over 8 yearsJust want to report that the Category in ObjC link no longer exists.
-
Jared Egan over 8 years@Arc676 Categories definitely still exist.
-
Hima almost 7 yearsBoth links are expired now.
-
mr5 almost 7 yearsOfficial documentation: developer.apple.com/library/content/documentation/Cocoa/…