Forum Navigation
You need to log in to create posts and topics.

Setting a different menubar ( or other approach ) in Cocoa/Objective-C

Posted by: fblistserve <fblistserve@...>

On Oct 13, 2012, at 1:39 PM, Brian S <fblistserve@cox.net> wrote:


My app displays a slightly different menu bar for shareware and Mac App Store ( MAS ) users. The shareware users see the registration option in the File menu and the "Check for Updates" in the app menu. MAS users aren’t presented these irrelevant options.

My Carbon app code simply loads the correct menubar for the user( MAS or shareware ) using Carbon calls CreateNibReference() and  SetMenuBarFromNib() ( actually a compile-time directive '#if' makes the decision about which menubar to load and thus the decision is "baked in" at compile time when creating either a MAS executable or shareware executable ).
Now it is time to implement this functionality for a Cocoa app with a nib ( and obviously without Carbon calls ). NSBundle and NSNib calls showed up in my searches but so far I’m not sure how to accomplish the goal. Any thoughts welcome.

Since the MAS menu bar is a subset of the shareware menu bar, my plan is to start with the shareware menu bar and remove specific menu items ( by getting a reference to the menu via an outlet and removing menu items via NSMenu calls such as removeItemAtIndex: ) if it is a MAS build.

Brian S.


To unsubscribe, e-mail: fbcocoa-unsubscribe@welovegod.org For additional commands, e-mail: fbcocoa-help@freegroups.net