我有一個NSTableView,它顯示一些代表我的自定義對象的信息。我沒有使用綁定。將可編輯的NSTextFieldCell添加到我的NSTableView
通常,我創建自己的NSCell來顯示數據,但是一旦我在NSTextFieldCell之後顯示對象的字符串值,並讓用戶編輯它。
我可以使用下面的代碼成功地添加NSTextFieldCell,但它不可編輯。
NSTextFieldCell *textField = [[NSTextFieldCell alloc] init];
[textField setFont:[NSFont fontWithName:@"Helvetica Bold" size:13]];
[textField setTextColor:[NSColor colorWithDeviceRed:0.1058823529 green:0.2117647059 blue:0.3294117647 alpha:1.0]];
[textField setStringValue:projectName];
[textField setEditable:YES];
[textField setBordered:NO];
[textField drawWithFrame:textRect inView:controlView];
[textField release];
有人可以幫助我嗎?