Retrieving Data in A NSTableView
Posted
by
Heisennberg
on Stack Overflow
See other posts from Stack Overflow
or by Heisennberg
Published on 2012-12-14T23:46:18Z
Indexed on
2012/12/17
5:03 UTC
Read the original article
Hit count: 161
objective-c
|cocoa
I have a three column Table View populated by two NSMutableDictionaries which share the same keys (ie key | value1 | value2 ) with dict1(key,value1) and dict2(key,value2). I want to manually enter data in the third column and create the key/value objects in dict2. But when I do that, my code picks the wrong key :S
Here's the code for the delegate :
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
{
if ([[aTableColumn identifier] isEqualToString:@"value2"])
{
[dict2 setValue:anObject forKey:[[[aTableView tableColumnWithIdentifier:@"key"] dataCellForRow:rowIndex] stringValue ]];
}
}
Any idea ?
© Stack Overflow or respective owner