0

在我的 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
//------------------------------------------------
4

1 回答 1

0

我在https://github.com/johnjohndoe/NSPopUpButtonCell找到了我想做的示例代码

我希望这可以帮助下一个人!也非常感谢 github 上的那个人 toooooooo

于 2014-10-10T10:40:24.063 回答