I have a class structure of the type UIViewControllerSubclass : UIViewController
, where the only function of UIViewControllerSubclass is to #import UIViewController+Category.h
. The reason I added methods in a category is so that I can also make UITableViewControllerSubclass : UITableViewController
, which will #import UIViewController+Category.h
as well. As we all know, don't repeat yourself.
Now assume that UIViewController+Category.h has the structure:
@interface UIViewController(Category)
- (void) method1;
- (void) method2;
@end
How safe is it to create UIViewControllerSubclassSubclass : UIViewControllerSubclass
, which will override method1
? I assume this will work because of Objective-C's message passing, but for some reason my intuition is telling me that I'm doing it wrong.