一旦用户点击触发操作的单元格,我想禁用用户交互,然后在操作完成后重新启用用户交互。有人可以告诉我该怎么做吗?
最佳答案
只需检查 TableView 委托(delegate)方法中的条件:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *categoryIdentifier = @"Category";
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
//Way to stop to choose the cell selection
if(indexpath.row == 0){
cell.selectionStyle = UITableViewCellSelectionStyleNone;
// OR
cell.userInteractionEnabled=False;
}
//while rest of the cells will remain active, i.e Touchable
return cell;
}
关于iphone - 如何禁用 UITableView 的单个单元格的选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6318251/