Reputation: 1026
I want to do the following :
@interface UINavigationController ()
-(void)removeFromNavigationStack:(Class)aClass;
@end
and in .m file
@implementation UINavigationController
-(void)removeFromNavigationStack:(Class)aClass {
}
but in the .m file there are a lot of warning like "Method definition for 'initWithRootViewController:' not found"
how can I avoid this ? I've tried including but still have the warnings
Thanks
Upvotes: 0
Views: 93
Reputation: 5026
Since you're dealing with UINavigationController
, a UIKit class, you probably want to go with a category, instead. Extensions need to be defined within the main @implementation
block of the class's implementation, and you don't have access to that for UINavigationController
From the docs:
Class extensions are like anonymous categories, except that the methods they declare must be implemented in the main @implementation block for the corresponding class. Using the Clang/LLVM 2.0 compiler, you can also declare properties and instance variables in a class extension.
Upvotes: 4