gpt4 book ai didi

objective-c - 如何从 cocoa 的 super View 中删除imageview?

转载 作者:行者123 更新时间:2023-12-03 17:19:49 24 4
gpt4 key购买 nike

当我重新加载单元格的NSTableView ImageView 时被覆盖。如何从 cocoa 的 super View 中删除imageview?

enter image description here

我尝试过以下代码:

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];

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

最佳答案

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

编辑的 NSTABLEVIEW

关于objective-c - 如何从 cocoa 的 super View 中删除imageview?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34991583/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com