문제

문서를 스캔하고 공정하게 광범위하게 Google을 사용 하여이 주제에 대해 아무것도 찾지 못했습니다.

일이 필요한 것은 내 nswindows 중 하나의 특정 인스턴스와 상호 작용하는 것입니다. 즉, xcode에서 문서 기반 응용 프로그램을 만들어 NSDocument 시스템을 통해 생성 된 NSDocument 시스템을 통해 생성 된 하나입니다.

이 작업을 수행하는 방법이 있습니까?[[nssharedDocumentController FrontMopeMankow] Subview :해도], 아마도?

도움이 되었습니까?

해결책

To obtain the frontmost window (aka the main window), use -[NSApplication mainWindow]:

NSWindow *mainWindow = [NSApp mainWindow];

To obtain the window corresponding to a given document:

NSDocument *someDocument; // reference to the document you’re interested in
NSWindow *window = [[[someDocument windowControllers] objectAtIndex:0] window];

NSDocument creates a single window controller to manage the corresponding document window, so -[NSDocument windowControllers] returns an array with a single element corresponding to the window controller. -[NSWindowController window] returns the window managed by that window controller.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top