嵌入在绑定的NSTableColumn中时出现NSPopUpButtonCell错误

时间:2014-10-10 05:55:02

标签: nstableview key-value-coding nspopupbuttoncell

在NSPopUpButtonCell类型的NSTableView中绑定单元格时出错

[<NSTableColumn > valueForUndefinedKey:]: this class is not key value coding-compliant for the key value.

现实是我只是将NSPopUpButtonCell的内容作为字符串

但我改变了

NSString *name;

NSObject *name;

这使我的应用程序加载但在尝试将内容显示到显示NSPopUpButtonCell列的NSTableView时崩溃

ERROR: unrecognized selector sent to instance

当我有一个UNBOUND单元格时,我没有收到错误,如果单元格类型为NSTextFieldCell,我没有问题,可以使用NSString类。

我猜这是关于将正确的位连接到所有内容,从我在错误上看到的内容,所以,我如何让弹出单元格显示弹出按钮,但保存所选卖出的价值实际数组?

由于

//------------------------------------------------
//my.h
//------------------------------------------------
@interface theItemsInArrayC : NSObject {
@private
    NSString *name;
    int age;
}
@property int age;
@property (copy) NSString *name;
@end

@interface mybigList : NSObject {
@private
    NSMutableArray  *theItems;
}
@property (copy) NSMutableArray  *theItems;
@end
//------------------------------------------------

//------------------------------------------------
//my.m
//------------------------------------------------
@implementation theItemsInArrayC
@synthesize name;
@synthesize age;
- (id)init
{
    self = [super init];
    if (self) {
        age = 19;
        name = @"Another Name";
    }
    return self;
}
@end

@implementation mybigList
@synthesize theItems;
- (id)init
{
    self = [super init];
    if (self) {
        theItems = [[NSMutableArray alloc] init];
    }
    return self;
}
@end
//------------------------------------------------

1 个答案:

答案 0 :(得分:0)

我在https://github.com/johnjohndoe/NSPopUpButtonCell

找到了我想要做的示例代码

我希望这有助于下一个人! 并且非常感谢github上的那个人太多了。