user3065901
user3065901

Reputation: 4778

NSTableview column with multiple textfields

I have a NSTableView with one column and two textfields in it. My problem is that i need to call those two textfield and i only can access one of them. In the file inspector i noticed that the first textfield has the Table Cell View referencing outlet, but when i try to reference the second one it only shows an outlet called "nextKeyView". What is nextKeyView?

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {

// Get a new ViewCell
NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];

//THIS IS MY FIRST TEXTFIELD OF CELL
cellView.textField.stringValue = @"MY TEXT";

//HOW TO CALL SECOND TEXTFIELD ??
....

return cellView;
}

Sorry for my poor english. Thanks in advance! My application is for OS X not iPhone!

Upvotes: 0

Views: 830

Answers (1)

uchuugaka
uchuugaka

Reputation: 12782

nextKeyView is a pointer to the next view that can take key input. Normally you can press tab to reach the next key view. You can set the key order in IB or in code

If you need an outlet to your additional text field, you need to create a subclass of NSTableCellView and declare an additional NSTextField property as an IBOutlet. Then in IB set the class of your cell view template in the inspector to be the same as your subclass. The IB inspector will show the outlet. You can then link it to your second text field.

Upvotes: 3

Related Questions