我将基于 4 个 tableviewcells 的搜索字符串放在一起,每个单元格打开一个 subview 并加载用户选择的一组数据以设置前一个 View 的单元格。
需要设置这些单元格的顺序,以便 subview 中每个前面的数据列表都与父 View 中的数据集相关。
即在第一个单元格中选择一种汽车类型,在下一个单元格中查看与所选汽车类型相关的模型。
除此之外我的问题的基础是如何在设置前一个单元格之前使单元格不可选择。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//...
if (indexPath.section == 0)
{
if (indexPath.row == 0) // <<--- what could I put in here....
{
//...
}
}
最佳答案
不允许单元格跟踪任何交互:
[cell setUserInteractionEnabled:NO];
或允许交互,隐藏选择颜色,点击时什么都不做。
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
- (void) tableViewDidSelectRow.... {
if(indexPath.row == indexOfCellWithNoUserInteraction) {
//do nothing
}
}
关于iphone - 如何使 uitableviewcell 不可选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7799222/