实现uitable cell中点击button设置当前cell为选中状态
- (void)buttonClick:(id)senser
{
NSInteger tag = [senser tag];
NSLog(@"the button tag is %d",tag);
for (int row = 0; row<6; row++)
{
NSIndexPath *indexPathHighlight = [NSIndexPath indexPathForRow:row inSection:0];
UITableViewCell *newCell = [self.customTableView cellForRowAtIndexPath:indexPathHighlight];
[newCell setSelected:NO animated:NO];
if (row == tag)
{
[newCell setSelected:YES animated:NO];
}
else
{
[newCell setSelected:NO animated:NO];
}
}
}