2013-02-08 92 views
1

我有一个NSMutableArray填充NSMutableDictionaries。所有这些数据都显示在NSTableView中。无法编辑NSTableView中的表格

问题是当我尝试编辑单元格时。我的tableview绑定到我的类与数据源绑定。并编辑单元格的值我用这个代码:

-(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row{ 

NSMutableDictionary *i = [list objectAtIndex:row]; 
NSString *identifier = [tableColumn identifier]; 
[i setValue:object forKey:identifier]; 

} 

但其异常触发的错误:

2013-02-11 20:50:35.960 prog[424:303] Exception detected while handling key input. 
2013-02-11 20:50:35.960 prog[424:303] [<__NSDictionaryI 0x105986580>  setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key filename. 
2013-02-11 20:50:35.964 prog[424:303] (

我不知道为什么我收到此错误NSDictionaryI。即使我将字典添加到数组中,我仍在使用NSMutableDictionary。任何帮助赞赏。

回答

0

我发现问题了!

当我添加元素到我的数组我使用COPY。删除它使其工作!

[myNSMutableArray addObject: myNSMutableDictionary];

我使用

[myNSMutableArray addObject:copy myNSMutableDictionary];

0

我觉得

setValue:forUndefinedKey 

手段,你有你的TableColumn的标识符的问题。检查Interface Builder中的设置标识符和/或设置一个断点(或者只是做一个NSLog(@“%@”,tableColumn.identifier);)

+0

感谢之前,却发现问题了!无论如何谢谢你的尝试! – sharkyenergy 2013-02-12 07:02:26