What's the difference and use of categories and inheritance? [duplicate]
Possible Duplicate: Difference between inheritance and Categories in Objective-c When should I use subclassing and when should I use categories? 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; 来源: https://stackoverflow.com/questions/13344075/whats-the-difference-and-use-of-categories-and-inheritance