开发者

linking file menu items to buttons

开发者 https://www.devze.com 2023-02-05 04:50 出处:网络
I\'m in need of linking some buttons in a \'document based\' application to the file menu (bold text, italic text, make text bigger etc.). The issue is that since its a document based application, the

I'm in need of linking some buttons in a 'document based' application to the file menu (bold text, italic text, make text bigger etc.). The issue is that since its a document based application, the MainMenu.xib is a completely dif开发者_如何学运维ferent XIB file than the MyDocument.xib, so I can't drag the connections in Interface Builder like I usually would. Does anyone have a workaround? Is there a way to link button actions to a separate XIB files' built in menu functions?

Zach


Generally, you use the First Responder place-holder object.

About the First Responder

"In Interface Builder, the First Responder is a proxy object that represents the first object in your application’s dynamically determined responder chain. Because the responder chain of an application cannot be determined at design time, the First Responder proxy acts as a stand-in target for any action messages that need to be directed at the application’s responder chain. Menu items commonly target the First Responder proxy. For example, the Minimize menu item in the Window menu hides the frontmost window in an application, not just a specific window, and the Copy menu item should copy the current selection, not just the selection of a single control or view. Other objects in your application can target the First Responder as well."

Also see: Connecting Menu Items Across Nib Files

Also, if you want to create buttons whose actions are basically the same as the Format > Bold, etc. commands, see: Connecting the Font Menu in Interface Builder 3

0

精彩评论

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