How to access items in the main nib from a documen

2019-08-27 09:19发布

I'm making an NSDocument-based application in which I have an inspector window. This inspector window is part of Pwnshop.nib which is my main nib. I have another nib called 'Document.nib,' which is the document window. I want to be able to change the inspector based on which document window is the active one, sorta like Interface Builder's inspector. The problem is that I want to access an object in another nib. Note that there are multiple document windows, but only one inspector window.

Could anyone help me?

2条回答
走好不送
2楼-- · 2019-08-27 09:37

This is essentially the same question as found here. The answer is the same, too. You need to read the documentation and learn about Communicating with Objects and plan your architecture so that you get get to some universally-reachable controller (eg [[NSApp delegate] myInspectorController]) from your NSDocument instances.

查看更多
趁早两清
3楼-- · 2019-08-27 09:44

I can recommend both this and this article (both from Cocoa with Love) for a fundamental lesson in how to structure a Cocoa project. They will answer all of your questions and get you started on a path to building applications the right way.

查看更多
登录 后发表回答