I have created some method in category file. I just want to reuse those methods in my view controllers. So I have imported that category file in view controllers and declared the method in header file also. calling it like this:
Category class:
@interface UIViewController (headerView)
-(UILabel *)someMethod;
@implementation UIViewController (headerView)
-(UILabel *)someMethod{
}
HomeViewController:
@interface HomeViewController : UIViewController
-(UILabel *)someMethod;
@implementation HomeViewController
[self someMethod];
I am getting warning message in this line:
@implementation HomeViewController
It's working. But I want to clear this warning. How can I do it?
If you want you category in view controller do it something like that
Your category
@interface UIViewController (ExtendedMethods)
- (void)someMethod;
@end
@implementation UIViewController (ExtendedMethods)
- (void)someMethod {
NSLog(@"Some method");
}
@end
MyViewController.m
#import "MyViewController.h"
#import "UIViewController+ExtendedMethods.h"
@implementation MyViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self someMethod];
}
@end