Can anyone explain why we need categories.I need to use categories in my project but don't have an idea how to use category and why we need to use categories.
Asked
Active
Viewed 1,615 times
-4
-
1Can you please elaborate ur question ?? Its pretty vague ... – IronManGill Feb 06 '13 at 05:42
-
please check this link : http://stackoverflow.com/questions/7414011/what-is-category-in-objective-c – Sagrian Feb 06 '13 at 05:49
-
yes, its really nice link thanks @Sagrian – Meenakshi Katal Feb 06 '13 at 05:53
2 Answers
1
First you need to use google for searching the answer.
You'll get a lot of tutorials, like:
- Objective-C Categories
- Categories in Objective C
- Objective-C: Categories
- Customizing Existing Classes
Suppose if you need to add a method to the NSString
class for validating the email address, then you need to use category. You can use category to add extra methods to the existing class. Then you can use the object of the existing class, according to the example above, the object of NSString
to invoke the added method.

Midhun MP
- 103,496
- 31
- 153
- 200
0
You'll get better description on :: http://mobile.tutsplus.com/tutorials/iphone/objective-c-categories/

Manann Sseth
- 2,745
- 2
- 30
- 50