0
我一直在這裏拉我的頭髮,在蘋果的素描應用程序的源代碼,在這裏可以看到:developer.apple.com/samplecode它們將一個NSArrayController綁定到一個數組NSDocument。蘋果的草圖源代碼NSArrayController綁定
當他們這樣做的NSWindowController的一個NSView:
[mutableGraphics insertObject:_creatingGraphic atIndex:0];
它調用的代碼在NSDocument:
- (void)insertGraphics:(NSArray *)graphics atIndexes:(NSIndexSet *)indexes {
我的問題是怎麼做?我希望能夠以編程方式做到這一點,似乎在這裏發生了某種魔術。
我結合我的NSArrayController的是這樣的:
[_componentsController bind:NSContentArrayBinding toObject:self withKeyPath:@"document.components" options:NULL];
但我不知道它是如何調用自定義的方法來代替。
在這個和我所有的頭髮將會消失幾天,任何指針/提示大受歡迎。
感謝
克里斯