ios - 从行中删除表附件指示器

标签 ios iphone uitableview ipad accessorytype

有没有办法单独禁用行中的辅助指示器?我有一张使用

- (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/

相关文章:

iphone - 属性 txtname (uiTextView *) 的类型与 ivar txtname(uiTextView) 不匹配

ios - UITableview 根据所选单元格显示不同的数据

iphone - Cell TextLabel 多行不再工作

ios - 在彼此之上的相同 View 之间交叉淡入淡出

ios - 更改 uiviewcontroller View 框架?

ios - 如何使用 Apple 的数据保护 API 加密我的数据?

arrays - 迅速,将 NSIndexpath 转换为 Int

ios - 这里 Maps SDK iOS Swift 3 文档

iphone - 如何在core-plot中绘制Y轴网格?

ios - 比较sqlite表中的整数?