I have three buttons in a three column structure in a custom cell in a .xib
See pic:
I also have two classes one which holds the list and the second one which holds the cell I have managed to log out the touch of the button in the class which belongs to the cell, but I also want to know if they touched the firstColumnButton I want didSelectRowAtIndexPath to trigger.
My ultimate goal is to trigger didSelectRowAtIndexPath, to find out which cell has been pressed, which button in that cell so the user can go to the right content which they pressed on.
In ListController.m:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Pressed on the table");
if(cell.pressedButtonInColumnOne == YES){
NSLog(@"Pressed button one in column one");
}
}
Right now the first NSLog does not trigger at all.
Only this in the CategoryCell.m
- (IBAction)pressedFirstColumnButton:(id)sender {
NSLog(@"pressed first button in category cell");
}
If I move the buttons up the ladder in IB then the table reacts, but then the buttons does not get pressed.
The answer is not solved but I did a workaround by making a selector to the buttons and just put the code in there,
cell.secondColumnButton.tag = guideColumnTwo.GuideID.intValue;
[cell.secondColumnButton setTitle:guideColumnTwo.Name forState:UIControlStateNormal];
[cell.secondColumnButton addTarget:self action:@selector(whichButtonDidMasterPressed:)
forControlEvents:UIControlEventTouchUpInside];
I set the buttonLabel to the city and tagged the button with an id.
It would be great if someone actually solved this anyway.
The made the
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
method useless.