0

だから私は次のように NSWindowController を作成しています:

if ( summaryWindow ) {
    [summaryWindow release];
} // end if
summaryWindow   = [[SummaryWindowController alloc] init];

次に、このオブジェクトに、NSTableView に使用する配列を渡します。

[ summaryWindow setGlobalStatusArray:globalStatusArray];

そのオブジェクトが作成されると、新しく作成されたオブジェクトのアクションとアウトレットをリンクするという基本的なことを行う方法がわからないことに気付きます。xib でオブジェクトを作成し、メソッドをリンクすると、アクションを実行できますが、xib が NSWindowController の別のインスタンスを作成したため、配列にアクセスできません。配列も渡します。

4

2 に答える 2

1

ウィンドウコントローラーを適切に初期化するだけです。[[SummaryWindowController alloc] init];ウィンドウなどを知らない空のウィンドウコントローラーを作成するだけです。xib ファイルでロードできます。次のようにします。

summaryWindow   = [[SummaryWindowController alloc] initWithWindowNibName:@"YourWindowNIB"];
于 2011-08-18T19:49:13.963 に答える
0

そのため、NSNotifications を介してこれを実行し、userInfo を介して情報を渡すことになりました。

// Register for notifications on Global Status Array updates
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(reloadTableBuffer:) 
                                                 name:StatusUpdateNotification
                                               object:nil];

そのようです:

- (void) reloadTableBuffer:(NSNotification *) notification
{
    if(debugEnabled)NSLog(@"DEBUG: Was Told to Reload Table Buffer...");
    NSDictionary *globalStatusUpdate = [notification userInfo];
于 2011-08-24T05:27:17.523 に答える