-3

Possible Duplicate:
Difference between inheritance and Categories in Objective-c

When should I use subclassing and when should I use categories?

Community
  • 1
  • 1
user1007352
  • 11
  • 1
  • 1

1 Answers1

0

Subclass when you want to extend the functionality utilized by the base.

@interface MyObject: NSObject<SomeProtocol>

Add a category when you want to add a convenience method to code you may not control.

@interface UIView (MyViewAdditions)

- (void)recursiveEnumerateSubviewsUsingBlock:(void (^)(UIView *view, BOOL *stop))block;
tillerstarr
  • 2,616
  • 1
  • 21
  • 35