1

当我重新加载NSTableView单元格的图像视图时被覆盖。如何从可可的超级视图中删除图像视图?

在此处输入图像描述

我试过下面的代码:

NSImageView *tabIconImageview1=[[NSImageView alloc]initWithFrame:NSMakeRect(45, 12, 40, 40)];

[tabIconImageview removeFromSuperviewWithoutNeedingDisplay];
[tabIconImageview removeFromSuperview];
if ([strFilenames hasSuffix:@"."])
{
    [tabIconImageview1 setImage:[NSImage imageNamed:@"fileicon"]];
    //tabIconImageview1.image=[NSImage imageNamed:@"fileicon"];
}
else if ([strFilenames hasSuffix:@".exe"])
{
    [tabIconImageview1 setImage:[NSImage imageNamed:@"exeicon"]];
}
else if ([strFilenames hasSuffix:@"png"])
{
    [tabIconImageview1 setImage:[NSImage imageNamed:@"imageicon"]];
}
else if ([strFilenames hasSuffix:@".zip"])
{
    [tabIconImageview1 setImage:[NSImage imageNamed:@"zipicon"]];
}
else //if ([strFilenames hasSuffix:@"."])
{
    [tabIconImageview1 setImage:[NSImage imageNamed:@"foldericon"]];
}

[cellView addSubview:tabIconImageview1];

看我的截图,图像重叠。我怎样才能在可可中阻止它?

4

1 回答 1

0

如果这是 NSTableView,请尝试刷新“已编辑”单元格或整个表格以重绘

编辑 NSTABLEVIEW

于 2016-01-25T11:57:00.330 回答