I created a sub-class of UIViewController called toolbarViewController , I declare a UIButton in this view controller and specified it's target as following
UIButton *button = [[UIButton alloc]initWithFrame:myFrame];
[button addTarget:self action:@selector(doSomething) forContorlEvents:UIControlEventTouchUpInside];
then i do the following in a different view controller
toolbarViewController *toolbar = [[toolbarViewController alloc]init];
[self.view addSubview:toolbar.view];
the problem is that when i press the button i get the exception: Unrecognized selector ( doSomething ) send to instance , what am i doing wrong here ?
doSomething declaration in toolbarViewController.h
-(void)doSomething;
and in toolbarViewController.m
-(void)doSomething{ NSLog("doSomething got called"); }
doSomethingmethod? If yes, in which class? - Ilanchezhian