-4

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.

2 Answers2

1

First you need to use google for searching the answer.

You'll get a lot of tutorials, like:

  1. Objective-C Categories
  2. Categories in Objective C
  3. Objective-C: Categories
  4. 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