将必须标记/取消标记(假设ü只需要一次一个选择)边框颜色连连喜欢 -
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row==self.selectedRow){
cell.borderView.layer.borderColor = [UIColor yellowColor].CGColor;
}else {
cell.borderView.layer.borderColor = [UIColor clearColor].CGColor;
}
}
只需保存/缓存选择指数喜欢 -
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
//Unselected the prevoius selected Cell
YourCellClass *aPreviousSelectedCell= (YourCellClass*)[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.selectedRow inSection:0]];
aPreviousSelectedCell.borderView.layer.borderColor = [UIColor clearColor].CGColor;
//Selected the new one-
YourCellClass *aSelectedCell = (YourCellClass*)[tableView cellForRowAtIndexPath:indexPath];
aSelectedCell.borderView.layer.borderColor = [UIColor yellowColor].CGColor;
self.selectedRow = indexPath.row;
}
你正在做的多个选择或单个选择... –
[细胞setShowsTouchWhenHighlighted:YES];尝试这一个... – Jitendra