-2

I am using addTarget on custom cell button like:

[cell.btnGet addTarget:self action:@selector(getLocal:cell:) forControlEvents:UIControlEventTouchUpInside];

It should be call this method:

-(void)getLocal:(id)sender withcell:(GroupListCell *)cell
{
    // code for implement
}

but when I am click the button it is throwing error like:

2013-02-27 14:28:56.533 iOSPlayer[704:11303] -[GroupView getLocal:cell:]: unrecognized selector sent to instance 0x72e1290
2013-02-27 14:28:56.534 iOSPlayer[704:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[GroupView getLocal:cell:]: unrecognized selector sent to instance 0x72e1290'

What is the issue here?

4

2 回答 2

1

try this:

[cell.btnGet addTarget:self action:@selector(getLocal:withcell:) forControlEvents:UIControlEventTouchUpInside];
于 2013-02-27T09:08:32.947 回答
1

That action method is called:

getLocal:withcell:

and not:

getLocal:cell:

It also doesn't match any of the acceptable action method signatures, which are:

- (IBAction)doSomething;
- (IBAction)doSomething:(id)sender;
- (IBAction)action:(id)sender forEvent:(UIEvent *)event;

(see this Apple guide)

于 2013-02-27T09:09:43.400 回答