Monday, January 13, 2014

Button button has a custom cell, press the button, how to get the row where the value of the button row

There are a custom cell Button button, press the button at the same time how to get the row where the value of the line of the button (that is, both to respond to button events must respond - (void) tableView: (UITableView *) tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath event), the god of the trouble you advise follows Figure
Reply:
[(UIButton *) [cell viewWithTag: 5] addTarget: self action: @ selector (btnPress :) forControlEvents: UIControlEventTouchUpInside];
UIButton * btn = (UIButton *) [cell viewWithTag: 5];
btn.tag = indexPath.row +100;
Reply:
Button to set the tag value, with a fixed relationship between the value of row

No comments:

Post a Comment