I have a UIButton inside a class. I want to set a target for the button like so.
[myController.dateButton addTarget:self action:@selector(showAction:) forControlEvents:UIControlEventTouchUpInside];
For some reason, the selector is never called when I press the button. I tried to debug the problem by doing the following but I get nil for the NSSet
NSSet *allTargets = [myController.dateButton allTargets];
Any suggestions on what I may be doing wrong?
The selector is defined as follows:
- (void)showAction:(id)sender
{
// Do stuff
}
Best Answer
Maybe this be the solution, cz i dnt think there's anything wrong in your code.
When you declare your button as
never have the release called on that btn.
I tried this my selves and it was working fine.