我已经能够成功地将我的视图绑定到NSCollectionView
,但是我的模型没有正确绑定到视图本身。我的模型包含一些属性:
@interface MPReportBuilderCustomReportFilter : NSObject
@property (assign) MPReportBuilderTableColumnRecord *column;
@property (assign) NSString *columnName;
@property (retain) NSMutableArray *dataArray;
@property (assign) NSArrayController *dataArrayController;
-(id)initWithTableColumn:(MPReportBuilderTableColumnRecord *)column;
-(void)loadDataArray;
@end
我能够以编程方式在我的模型类中绑定一个数组控制器,它会成功绑定到数据数组:
@implementation MPReportBuilderCustomReportFilter
-(id)initWithTableColumn:(MPReportBuilderTableColumnRecord *)column
{
self = [super init];
if (self) {
self.column = column;
self.columnName = self.column.columnName;
self.dataArray = [[[NSMutableArray alloc] init] autorelease];
self.dataArrayController = [[NSArrayController alloc] initWithContent:nil];
[self.dataArrayController bind:@"contentArray" toObject:self withKeyPath:@"dataArray" options:nil];
[self loadDataArray];
}
return self;
}
我能够成功地将我的模型数组绑定到NSCollectionView
绘制视图的模型,但是我想将模型绑定到视图中的每个单独NSMutableArray
的NSTableView
视图。我认为没有办法以编程方式执行此操作,因为您绑定到Collection View Item.representedObject
. 我觉得你做不到Collection View Item.representedObject.dataArrayController.arragnedObjects
?