objective c - Working with the frontmost window's controls in a document-based app? -
i've scanned documentation , googled extensively , found nothing on subject.
what i'm needing interact specific instance of 1 of nswindows - is, 1 created through nsdocument system put in place creating document-based application in xcode.
so there way this? [[nsshareddocumentcontroller frontmostwindow] subview: doaction], perhaps?
to obtain frontmost window (aka main window), use -[nsapplication mainwindow]:
nswindow *mainwindow = [nsapp mainwindow]; to obtain window corresponding given document:
nsdocument *somedocument; // reference document you’re interested in nswindow *window = [[[somedocument windowcontrollers] objectatindex:0] window]; nsdocument creates single window controller manage corresponding document window, -[nsdocument windowcontrollers] returns array single element corresponding window controller. -[nswindowcontroller window] returns window managed window controller.
Comments
Post a Comment