- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[_mTabelView reloadData];
CategoryTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];//这就是获取cell的语句
cell.backgroundColor = [UIColor whiteColor];
cell.title.textColor = NORMALCOLOR;
cell.headImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@%d%@",@"sort_",indexPath.row - 1,@"_press"]];
}
在iOS开发中,当用户点击UITableView的某个单元格时,可以使用`didSelectRowAtIndexPath`方法来监听选中事件。在该方法内,通过`tableView cellForRowAtIndexPath:indexPath`可以获取到被选中的CategoryTableViewCell,并对其进行背景颜色、文字颜色和图片的设置。
5172

被折叠的 条评论
为什么被折叠?



