Re: Setting up a main menu in a NIB(XIB)?
Re: Setting up a main menu in a NIB(XIB)?
- Subject: Re: Setting up a main menu in a NIB(XIB)?
- From: "Kyle Sluder" <email@hidden>
- Date: Wed, 12 Nov 2008 00:28:46 -0500
On Wed, Nov 12, 2008 at 12:03 AM, Russ <email@hidden> wrote:
> I am trying to get my application menu (About/Preferences/Services/Hide/Quit) set up. My app has no need for NIBs,
There's no such thing as a Cocoa app which has no need for a nib.
> aside from that I've been told that one is required to set up the application menu due to some indeterminate Cocoa hard-wiring. I'm correspondingly clueless about IB and happy to stay that way as much as possible, no value added.
What kind of app are you developing that you need no user interface?
Creating your UI in code is the incorrect approach.
You cannot avoid Interface Builder in any Cocoa app that presents UI.
Doing so will produce pain, suffering, and untold bugs for which you
will find no solution.
> When my app starts, at the place I'd like to set the main menu up (before the run loop starts, during my app's initialization), [NSApp mainMenu] is nil, so it hasn't been read yet. If I hand it my app's menu (File/Edit/etc), when the app starts I see my menu, but not the application menu About/Preferences/etc. I can understand that----assuming the NIB gets read at some later time---in [NSApp run]???
You're going about it backwards. If you use an IB-made Main Menu nib
as your app bundle's main nib file, its application menu will be set
up for you for free. Connect an outlet on your file's owner delegate
to the main menu and manipulate the menu via this outlet in your
delegate's -applicationDidFinishLaunching: method.
But why are you so determined to avoid the correct way to write Cocoa
applications?
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden