I have a class with a function that needs to be called from inside and outside the class. The next code works fine but I was wondering, is there a way to have only one lowerKeyboard
method instead of two methods with - and + ?
If i'll keep just the + method I'll get an error unrecognized selector sent to instance
when trying to call the method from inside the class
From inside the class:
-(void)someOtherMethod
{
UIBarButtonItem *infoButtonItem=[[UIBarButtonItem alloc]initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(lowerKeyboard)];
}
from outside the class:
[myClass lowerKeyboard];
myClass:
-(void)lowerKeyboard
{
//do something
}
+(void)lowerKeyboard
{
//do the exact same thing
}