I have a custom cell with a button inside. My problem is action method is not calling when click on cell button
Right now I'm doing
UITableViewCell *cell = [self.tblHomeView dequeueReusableCellWithIdentifier:MyIdentifier];
MyCell * mycell2 = ((MyCell*)cell);
if (cell == nil) {
cell = [[[MyCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease];
[mycell2.column1 addTarget:self action:@selector(column1Selected:) forControlEvents:UIControlEventTouchDown];
[mycell2.column2 addTarget:self action:@selector(column1Selected:) forControlEvents:UIControlEventTouchDown];
}
In my cellForRowAtIndexPath method and my method is:
- (void) column1Selected: (id) sender
{
UIAlertView *alert = [[ UIAlertView alloc]
initWithTitle: @" Alert"
message: [NSString stringWithFormat: @"button %d",((UIButton *) sender).tag]
delegate: nil
cancelButtonTitle: @" OK"
otherButtonTitles: nil];
[alert show] ;
[alert release];
}
Any tips? Thank's