实现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];
        }

    }
 
}

posted @ 2013-11-13 16:29  如来藏  阅读(371)  评论(0编辑  收藏  举报