I have the following code that I'm using.
@interface SomeDudesSuperClass : NSObject {
}
@end
@interface SomeDudesSuperClass (Category_code_which_others_are_restricted_from_touching)
- (void)SomeDudesMethod;
@end
Now this below is my code
@interface SomeDudesSuperClass (A_Category_To_Override_A_Method_in_his_category) {
- (void)SomeDudesMethod;
}
@end
I am not allowed to touch his code. If I just write up another category, which method will be called? And how can I call my category method instead of his?
As rmaddy said, what you're doing is not a good idea and will result in undefined behavior. You shouldn't try to override methods in a category. If you absolutely can't touch the existing code you can reasonably do one of 2 things.
Subclass SomeDudesSuperClass
and override the method there.
Use method swizzling to swap the method implementation with your custom one instead of overriding. This also gives you the option of implementing this like a proper override and call the original implementation inside your custom method if you need to.
This article by Mike Ash has a very nice explanation of this.