I’ve got two view controllers that have some similar function. Some of them are IBActions. Is there a way to put them together(so that it’s easier to fix bugs)? I’ve tried inheritance but it seems that it does not work.
@implementation ClassA
-(IBAction)f
{
//some code here
}
@implementation ClassB
-(IBAction)f
{
//some code here
}
My question is that is there a way that I write function f once? If there is a bug, I could fix it more quickly this way.
in inheritence, you can just declare in parent class, like abstract function, and for each child defination will be separte, now you have to do is this
make a method in parent class that performs the logic only,
make two ibactionn methods both in childs and perform the current child’s UI tasks in that methods and use the parent’s logic method, that u created above, to get the data.
inform if you get soltion or not.