How do you get the row for a button in a view based table when you click the button? The row is not selected when the button is clicked, but I found that if you log sender.s
Here I'm giving you a simple example. In this I'm adding a UIButton in content view. When I clicked on button I call a Method and there I get Row number and call as I required
//Adding a button
UIButton *btnBuyer=[UIButton buttonWithType:UIButtonTypeCustom];
btnBuyer.frame=CGRectMake(238, 10, 26, 32);
btnBuyer.tag=indexPath.row;
[btnBuyer setImage:[UIImage imageNamed:@"buyIcon.png"] forState:UIControlStateNormal];
[btnBuyer addTarget:self action:@selector(goBuyTab:)forControlEvents:UIControlEventTouchUpInside];
[cellNew.contentView addSubview:btnBuyer];
And When User Clicks on this I got Id from the following method
-(void)goBuyTab:(UIButton *)sender{
NSLog(@"after click buy button function called goBuyTab");
NSLog(@"sender.tag in goBuyTab : %d",sender.tag);
int selectedRow=sender.tag;// This is row number
}
Hope this is what you required.