开发者

Mac mainmenu - help implementing a mainmenu

开发者 https://www.devze.com 2023-03-13 06:29 出处:网络
I have created my mainmenu in one of my window xibs. My application has multiple windows and the mainmenu should be the same for all of them.

I have created my mainmenu in one of my window xibs. My application has multiple windows and the mainmenu should be the same for all of them. But, for each window some of the items will be disabled and others enabled. The main problem that I see is the selectors. Since every window controller class (mm) implements some of the functions how can I use the interface builder to set the selectors across multiple controllers.

I guess I need some sort of a "MainMenu Manager" class that will know all of the window controllers that "wants" to get called from the main menu and also the manager will have the code for enabling/disabling items when switching between windows.

Does that make sense? am I missing something here? If no开发者_运维技巧t - can you provide any help on implementing this manager in terms of application flow? (It should probably init the main menu before I load my first application window)

Thanks,


Make the various targets and selectors properties of the window controllers, make the menubar in MainMenu.xib. Then bind the menu items' target and selector properties to "Application"mainWindow.windowController.property". You can bind other properties such as the title too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号