- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在尝试创建一个以空字符串作为标识符的列,但每次我尝试创建该列时,Cocoa 似乎都将空字符串替换为“Field”一词。你如何解决这个问题?
- (void)addColumnWithCheckboxToTable:(NSTableView *)table
{
// Add column with checkbox before all other columns
// This column will have no title and should be as wide as the checkbox
NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@" "] autorelease];
// The checkbox is to be initialised without a title
NSButtonCell *checkbox = [[[NSButtonCell alloc] initTextCell:@" "] autorelease];
[checkbox setEditable:YES];
[checkbox setButtonType:NSSwitchButton];
[checkbox setImagePosition:NSImageOnly];
[checkbox setControlSize:NSSmallControlSize];
// Add column with checkbox to table
[column setDataCell:checkbox];
// Add column to table
[table addTableColumn:column];
}
最佳答案
列的标识符与其标题不同。你想设置它的 -headerCell 的字符串值:
[[columnColumn headerCell] setStringValue:@""];
关于objective-c - 命名 NSTableColumn 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2134478/
我在 NSTableView 中有一列单元格,它们从应用程序的首选项 plist 中获取文本颜色。我想在突出显示时将文本颜色设置为白色,但一直无法找到一个好方法来做到这一点。 有人有什么想法吗? 最佳
我有一个包含 4 列的 NSTableView。我想更改第一个 NSTableColumn 的自动调整大小属性。如果用户调整应用程序的大小,则仅允许第一列更改其宽度。我的代码: // First 3
我想我会很聪明,将与每列强关联的 C++ 回调函数的地址存储在其 NSTableView 的 NSTableColumn 中。我对 NSTableColumn 进行了子类化,并添加了一个指针作为实例数
我不明白我的 NSScrollers 出了什么问题。 自从一段不定的时间以来(我一直在改变我的应用程序源代码中的很多内容,但不是它的 Xib 设计),我所有 的 NSScrollers配置有“Auto
我的应用程序中有以下模型。 Board,拥有下面 List 类型的 NSMutableArray 属性 lists List,包含下面 Card 类型的 NSArray 属性 cards Card,有
我有一个使用 XCode IB 构建的 3 列表格 (NSTableColumn)。 最后一列是“金额”,其前面的列是“说明”。当我调整窗口大小时,表格也会调整大小,但“金额”是跨度更宽的列。 如何固
我正在尝试以编程方式获取正在编辑的单元格的column.identifier。我试图通过为 NSControlTextDidBeginEditingNotification 注册 NSViewCont
我正在针对 Mac OS X 10.6 (Snow Leopard) 进行开发。当我在我的 NSTableView 的两个列标题之间双击时,左侧的列会自动调整大小,正如您所期望的那样。 我也想在上下文
我有一个 NSScrollView 和一个 NSTableView,其中有一些 NSTableColumn。当我按下按钮时,我用动画更改 NSScrollView 的宽度。这是我的代码: NSDict
我有一个带有单列的NSTableView。该列在 Interface Builder 中选中了“可编辑”,但双击 TableView 中的单元格不会执行任何操作。我已经确认(在 -tableView:
我的类有一个枚举属性。此属性绑定(bind)到 NSTableColumn。 typedef enum _Status { Unknown=0, Win, OSX } Stat
我在 Interface Builder 中创建了一个带有一些列的 NSTableView。我已将表格 View 设置为自动保存其设置(我在属性检查器中设置了自动保存名称并检查了列信息)。现在我想以编
我正在尝试创建一个以空字符串作为标识符的列,但每次我尝试创建该列时,Cocoa 似乎都将空字符串替换为“Field”一词。你如何解决这个问题? - (void)addColumnWithCheckbo
我在对 NSTableColumn 内容进行排序时遇到问题。在我的 NSTableView 中,有三列:文件、大小、路径。内容存储在 NSMutableArray 中。这个数组中的每个对象都是一个包含
我正在构建一个 Mac OS X 应用程序,该应用程序具有一个带有单个 NSTableColumn 的 NSTableView 和一个 NSSegmentedControl。当我选择不同的段时,我打算
有没有办法为 NSTableColumn 的每一行显示不同的小图像(图标)? 我不一定需要为其添加新列,我想知道是否可以在每行文本前面添加图标。 我知道有一个方法: - (void)setDataCe
型号 extension MyEntity { @nonobjc public class func fetchRequest() -> NSFetchRequest { re
我有一个包含 2 列的 NSTableView,其中单元格是普通的 NSTableCellView,其文本字段的文本是从字典中设置的。 这一切都是在 IB 中创建的,我只需将 TableView 拖/
我想在代码中以编程方式设置一些 NSTableColumns 的宽度(以便我可以在启动时恢复宽度),但我真的不知道如何应用文档中写的内容 for column in table.tableColumn
我正在尝试实现一种方法来清除所有项目和列的 NSTableView。但是当我尝试执行以下操作时发生崩溃: - (void)clearResultData { [resultArray remo
我是一名优秀的程序员,十分优秀!