有没有办法单独禁用行中的辅助指示器?我有一张使用
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellAccessoryDetailDisclosureButton;
}
我需要为单行禁用它(删除图标并且不触发详细信息披露事件)。 我以为这样就可以了,但没有结果。指示器仍然出现并且它仍然接收和触摸事件。
cell.accessoryType = UITableViewCellAccessoryNone;
最佳答案
该函数调用“accessoryTypeForRow..”现在已取消(从 sdk 3.0 + 开始)。
设置附件类型的首选方法是在“cellForRowAt..”方法中
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"SomeCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
// customize the cell
cell.textLabel.text = @"Booyah";
// sample condition : disable accessory for first row only...
if (indexPath.row == 0)
cell.accessoryType = UITableViewCellAccessoryNone;
return cell;
}
关于ios - 从行中删除表附件指示器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2998712/